Hi, I am using XamComboEditor(Infragistics.Controls.Editors.XamComboEditor). And I tried to Bind with ItemsSource property of XamComboEditor with MyProperty which is type of ObservableCollection<string>. The codebehind info: public partial class Window11 : Window { public ObservableCollection<string> myProperty;
public ObservableCollection<string> MyProperty { get { return myProperty; }
set { myProperty = value; } }
public Window11() { InitializeComponent(); Load(); }
public void Load() { myProperty = new ObservableCollection<string>(); LoadXamCombo(); xam.DataContext = MyProperty; }
public void LoadXamCombo() { MyProperty.Add("Active"); MyProperty.Add("InActive"); } } Xaml Code: <ig:XamComboEditor ItemsSource="{Binding Path=MyProperty,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=Window}}" CheckBoxVisibility="Visible" AllowMultipleSelection="False" Name="xam" Height="10" /> When I tried to expand the control , I observed as instead of Active & InActive values, 6 and 8. I am attaching the screenshot as an attachment. Could you please help, where i did mistake and How to get the values in XamcomboEditor "Active" & "InActive" Thanks in advance.. Regards, Chandra
Hello Chandra,
Thank you for your feedback. I am glad that you resolved your issue and I believe that other community members may benefit from this as well.
Thanks again.
Thanks Stefan..
It works...
Thank you for your post I have been looking into it and I created a sample project for you, using your code, with the functionality you want. Please let me know if this helps you or you need further assistance on this matter.
Looking forward for your reply.
Hi,
How to Bind the Itemsource of XamComboEditor with observablecollection, without assigning DataContext of XAmComboEditor to observablecollection in codebehind.
And without using StaticRosource..
Anyone has any idea, how to achieve it
I have posted my code
Thanks in advance,
Regards,
Chandra
I got some information from below article.
http://ko.infragistics.com.es/community/forums/p/69435/351753.aspx
>>
public partial class Window11 : Window { public ObservableCollection<string> myProperty;
public ObservableCollection<Test> test = new ObservableCollection<Test>();
public void Load() { myProperty = new ObservableCollection<string>(); LoadXamCombo();
// xam.DataContext = test; }
public void LoadXamCombo() { //MyProperty.Add("Active"); //MyProperty.Add("InActive");
test.Add(new Test { Status = "Active" }); test.Add(new Test { Status = "InActive" });
} }
public class Test { public string Status { get; set; } }
<<
Without setting Observablecollection to DataContext in code behind can achieve the same through Xaml?
Xaml code:
<ig:XamComboEditor ItemsSource="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:Window11}},Path=test}" DisplayMemberPath="Status" Height="10" Name="xam"/>
Could you please let me know, How to bind ItemSource to xamComboEditor
Thank you,