Hi ,
I am really new to WPF infragistics. I have an XamComboEditor that needs to have one out of 4 different lists as its ItemsSource based on a user event . Initially in the constructor of my code behind , I am setting the ItemsSource to one of the 4 lists right after InitializeComponent.
When I run the app , it adds 1,2,3... numbers to my XamComboEditor instead of the List I porvided.
Could you help me do this ? Is there any setting I need to override .
My XAML :
<ig:XamComboEditor ItemsSource="{Binding Attributes}" AllowMultipleSelection="True" CheckBoxVisibility="Visible" Name="XamComboEditor" HorizontalAlignment="Left" Margin="559,241,0,0" VerticalAlignment="Top" Width="171"/>
I should not want to set ItemsSource in XAMl since I will keep changing it based on user selection.
My code behind constructor:
public MainWindow() { List<string> Attributes =new List<string> // one of the 4 lists { "Name", "Client", "Country", "Field", "Geomarket", "Area", "Formation Types", "Fluid Types", "Drive Mechanisms", "EOR Processes" };
InitializeComponent();
XamComboEditor.ItemsSource = Attributes;
}
On debugging I found that it sets up the item source all right. but later on it gets overriden by numbers , which I couldn't track where it got those from.
Regards,
Prasaanth
Hello Prasaanth,
Thank you for your post!
I have been investigating this issue you are describing, and I have added the exact code that you have provided to my project, but I have not been able to reproduce this issue you are describing. My tests were made using Infragistics for WPF 2015.1 specific version 15.1.20151.2055 - is this the same version you are using?
I feel that there must be something else working on your XamComboEditor for the numbers to be showing instead of the List<string> that you are setting the ItemsSource to, but I am not entirely sure what that is from your description. I have attached the sample project that I used to test this. Could you please modify this sample project so that it reproduces this issue you are seeing and send it back?
Please let me know if you have any other questions or concerns on this matter.
Sincerely,AndrewAssociate DeveloperInfragistics Inc.www.infragistics.com/support
Hi Andrew ,
Thank you very much for your reply. The version my company has license for is 14.1. I tried the exact project you sent me (but I updated references to point to version 14.1 ) am still getting the numbers instead of the List i bound the control to. This seems very silly and basic and I don't know what I am doing wrong. I checked and there is nothing else in my project. except for the code that u have in the sample.
I am not sure if the difference in the versions affects something.
Is there a way I could zip back the whole project to you ?
Are you able to see the entire two images ?
You can view them here in full :
http://i.imgur.com/9G4N6Wf.png
http://i.imgur.com/3NKNL9F.png
I apologize for the delay in my response.
I modified my sample project to use Infragistics for WPF 14.1 and I was able to view the behavior you are seeing. After some investigation into our internal bug-tracking systems, I found a log for this. This issue was not really a bug, but rather a feature that was missing from the XamComboEditor, which was the ability to bind to collections of primitive types and display them correctly. This feature was added in our 15.1 product. I would recommend that you either upgrade your project to Infragistics for WPF 2015.1.
Alternatively, you could also create a custom class that encapsulates your string property. Then, have your List be a List<MyCustomClass> and populate it with your custom class objects. This custom class could have a string property on it, which you could use to store the strings that you are looking to display, and then after setting the ItemsSource to your List<MyCustomClass> you could set the DisplayMemberPath to the name of that string property.
Understood. I am not sure we can upgrade to 15.1 . We deploy our apps on a central framework and that framework still has 14.1 in it. So , upgrading just my one app may give us compatibility issues. So, it is just not possible to set List<string> to a XamCombo in 14.1 just because primitives are supported only for int ? I would want to avoid creating a custom class . All my string lists where I wish to use XamCombo will have to be mapped to this custom class. I also wish to use th XamCombo inside a Datagrid and am not sure how my mappings willl have to be there . There isn't any other alternative ?
An alternative that I can think of outside of wrapping your string in a custom class is to place all of your string entries from your List<string> into a Dictionary<int, string>. Then, you can set this as your XamComboEditor's ItemsSource. Keep in mind though, you will need to provide a DisplayMemberPath when doing this. The DisplayMemberPath in this case would be "Value."
I have attached an updated version of the original sample I sent to demonstrate the above.