Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
105
Some questions about XamlMultiColumnComboEditor
posted

Hello,

I'm new to your controls and WPF so for few days I tried to code something with XamlMultiColumComboEditor, and some problems has occurred.

1) How can I get a selected field, ie in a MessageBox, like MessageBox.Show(combobox.SelectedValue.ToString()); because SelectedValue is always null (I put this code in the SelectionChanged event of the control, that may be the reason) and others return me something I don't want and I don't understand.

2) Is it normal that I always have a blank column at the end of my rows ? If so, why, and (how) can I get rid of it properly ?

3) My control displays 3 columns from a dataset. Everything works well until I click on a row, then the text field displays only one value (the last one). Same question as above, but to display the whole row.

4) How can I change the name / title of headers ? They seem to take my database's fields' names, and I don't want that since it's camel cased but not really pretty.

Although this control (and some others) are really usefull, those problems are annoying me, but maybe I didn't search far enough...

And just to be curious : before I discovered Infragistics' controls, I tried to gather about 36 000 rows from my database in a combobox. It took so much time to initialize... and I was so impressed to see yours takes only... almost nothing ! How did you do that ? I struggled for a while to find a way to solve it !

Thanks for your help !

Parents
No Data
Reply
  • 6759
    Offline posted

    Hi Collin,

    Here are the answers:

    1. I'm not quite sure what exactly you mean by saying selected field. SelectedItem property returns the data item from the ItemsSource that has been selected. I suppose SelectedValue is always null because you've not set the  SelectedValuePath(lets say your data item is a class Person, if you set the SelecteValuePath to be "FirstName"(that person class should have a property FirstName) and the end-user has selected an item from the editor, the SelectedValue property would return the value of the FirstName property of the dataitem that has been selected). If you need more details on the selection scenarios and capabilities of the editor check out this help page.
    2. I cannot be sure until I see a sample application but I suppose you have the XamMultiColumnComboEditor's AutoGenerateColumns property set to true(that's also the default value, so if you haven't set it explicitly it is still true) and I suppose the data objects that you've provided to the control through the ItemsSource property all has an empty(null probably).So the editor sees that the data object has a propert and it generate a column for it, but it looks empty since all the item's values are null. Does that empty column has any header? If it does the header text is the name of the property of the data object that is returning null or empty string for all of the objects.
    3. The text field displays the value of the property that is pointed out in the DisplayMemberPath property. So lets get back to our Person example from above - if you've set DisplayMemberPath="FirstName" then the text in the editor would be the FirstName of thee selected person.
    4. The editor(assuming that AutoGenerateColumns=true) inspects the data object for a single row and create columns for most of its properties. The HeaderText for each column is resolved by the name of the property of the data object - that should be that database camel case names. So you need either to disable the autogeneration of the columns and define the columns you need. Each column has HeaderText property that you set  providing it the text that you want to be displayed in the header of that particular column. Important thing is that each column in the editor's columns collection need to have a Key that is unique through all columns. The key property of a column should be set so it points to the dataobject property that need to be visualized in the current column. So if we take the Person example again you will have a TextComboColumn with Key="FirstName" HeaderText="First Name". Check out the Configuring DataBinding and Visualization help page for the XamMultiColumnComboEditor.

    I would encourage you to take a look at the samples for this control so you get better feeling of it. Here's a link to the Silverlight samples for this control http://ko.infragistics.com/products/silverlight/multicolumn-combo. Don't mind it is Silverlight since the control is the same. You could find the samples for WPF if you got them installed. The SL ones are just more easy to reference here :)

    Finally XamMultyColumnComboEditor is so much faster than the MS ComboBox because of the UI Virtualization it uses. So basically when you bind the editor to 30K rows when firstly opened the MS ComboBox generate a Control representing every single item so that's 30K UI items generated on opening even though only couple of them are visible at a single moment. The XamMultiColumnComboEditor creates just enough UI items only for the items that are currently visible.

    Hope this helps,

Children