I want to bind ItemSource for a combobox within silverlight datagrid. It doesn't show the bound values. I have a dynamic ItemSource value which is coming from database. How can I do that?
Answer: 1
Currently ur combobox cant find the value coz it trying to find it in item
s(which DataGrid binded to) fields named "AndOrs". If u wand to bind column to independent of DataGrid on the whole, u should use full path/rel. souce for search needed property in DataContext and binding to it. For example if collection used for DataGrid`s ItemsSource defined near AndOrs:
<ComboBox ItemsSource="{Binding RelativeSource={RelativeSource AncestorType=sdk:DataGrid}, Path=DataContext.AndOrs}"/>
P.S. As i guess AndOrs property is not defined in item u use for DataGrid to bind to.
by : Dima Martovoihttp://stackoverflow.com/users/976231Answer: 2
I have the same problem. The best I could find for SL4 is to use a static resource.
See here: http://blog.digitaltools.com/post/2011/05/06/Binding-a-Datagride28099s-ComboBox.aspx
Or, by creating the static resource in xaml: http://forums.silverlight.net/post/370135.aspx
by : Peet Britshttp://stackoverflow.com/users/371917
No comments:
Post a Comment
Send us your comment related to the topic mentioned on the blog