Syncfusion listbox drag and drop not working when one of the list box is empty - listbox

I have the following code for drag and drop in syncFusion list box:
#Html.EJ().ListBoxFor(Model => Model.Inclusions).Width("100%").Datasource(Model.Inclusions).ListBoxFields(incl => incl.Text("Label").Value("TypeOfInclusionId")).AllowDrag(true).AllowDrop(true).Enabled(true).EnablePersistence(true)
#Html.EJ().ListBoxFor(Model => Model.Exclusions).Width("100%").Datasource(Model.Exclusions).ListBoxFields(excl => excl.Text("Label").Value("TypeOfInclusionId")).AllowDrag(true).AllowDrop(true).Enabled(true).EnablePersistence(true)
When the exlusion listbox contains at least one element, then I can do the drag and drop, but when the listbox is empty (any of them), then I cannot drag from listbox inclusion and drop in listbox exclusion and vice versa.
Any idea why? The Model.Exlusion is not set to null.

We suspect the issue might with model binding in Listbox. Please cross check if the Model values in listbox are bound properly.
You can find the runnable sample here for your reference.
Sample

Related

FMX Grid with Checkbox not displaying property

I have a grid with a CheckColumn connected through livebindings with a query. When i open my query all my data is loaded into grid, but the checkbox do not show. If i click on the grid then the checkbox appears.
Picture when i open my query:
When i click on the grid:
I discovered that using gridItens.Content.Repaint Redraw the checkboxes, for now I'll keep it that way, but I'll take a look at this component #Alberto Miola!

Can I use Delphi LiveBindings to create a two-column 'Name','Value' editable list from a TObjectBindSourceAdapter?

Using Delphi XE7 and FireMonkey I am looking at simple ways of displaying (and editing) some object property values in a TGrid. I have followed the tutorial showing how to bind TGrid columns to object properties and using a TObjectBindSourceAdapter I have a neat, single row grid populated from my one object as they show in the example.
However, I will only ever have one object in the grid (a single row) so I would really like to turn my grid data through 90 degrees to give me two columns - a fixed 'Name' and an editable 'Value'. My object properties would then be listed vertically (effectively like the Object Inspector view).
Is there a LiveBindings way of doing this, or should I use another control such a TListView? I'm new to LiveBindings!
Thanks for any suggestions.

Style a firemonkey combobox component

Trying to get a new style on a ComboBox in FireMonkey (XE2).
But for some odd reason I cannot get the text of a ListBoxItem to show.
What I've tried is the following.
Create a new FireMonkey HD Application.
On the form I've added a ComboBox.
Right click on the ComboBox and select 'Edit custom style'
There I've added the following components
while the original one consist out of the following components
Now it seems to me that I need the TContent object (but I can't seem to find it in the toolpallete)
How can i bind my Text object to the strings that are placed in my ComboBox?
Any pointers are very welcome.
FireMonkey doesn't use a TText object to display the text. Instead it creates a copy of the list box item within the TContent (if I remember correctly).
As you've worked out you need to add a TContent to your form. The easy way to do this is to
go back to the form,
right click and select View as Text
Find the TStyleBook object and add a TContent at the appropriate point (the format for this should be obvious from the rest of the file).
No need to add any properties - defaults will be used the first time.
Right click, View as Form.
Go back into the style editor and edit away.

List box values on postback

I am using asp.net mvc. I have used two list box in one of my views.
I transfer desired items from left-hand-side list box to right-side list box.
On a button click, i want to get the list box contents from right side list box.
I don;t get in form collection. Can anyone please suggest how can I get it?
thanks,
kapil
The only values in the list box that are selected will appear in the form collection.
When you transfer to the second list box, I would add a hidden field and add the cvalues into there (with some delimiter between). Upon POST you could split the string value of this hidden value to find contents of right hand list box.
Alternatively, just prior to Submit (intercept with JavaScript), set all values in right hand list box to selected.

how to set the tabwidth of the listbox portion of a TComboBox in Delphi

You can easily achieve a multicolumn effect in a listbox by setting the TabWidth property of TListbox. For example, http://delphi.about.com/cs/adptips2000/a/bltip1200_3.htm
I need to do the same in the drop down list of a ComboBox, but comboboxes don't publish any TabWidth property.
Any ideas?
In a comment to this answer advising you to owner-draw the list box items you say:
I'm wondering why I must do that when the required functionality already exists on a listbox
A combo box is actually composed of three native child windows - the combo box itself, an embedded edit, and a list box. You can use the GetComboBoxInfo() function to fill a COMBOBOXINFO structure (i.e. a TComboBoxInfo record) with information about the control, and it will return the 3 HWND elements in it. With that you are able to alter the appearance and behaviour of the list box. In principle.
For the list box to use the tab stops it needs to have the LBS_USETABSTOPS style flag set. Unfortunately this can't be turned on later, the list box has to be created with it. So you could use the functionality only if you were able to turn the style flag on for the list box, which is created during the CreateWindowEx() call for the combo box. AFAICS this can only be done by hooking the CreateWindowEx() call itself, identifying the internal call that creates the list box, and altering the passed style. This means runtime modification of code, and not in your executable but in a Windows DLL.
Owner-drawing the list items looks like it would be much easier.
From what I know there is not so simple way as TabWidth here but you can override Paint method and draw it yourself. Looking at listbox and combobox sources may help.

Resources