Saturday, September 1, 2012

Combobox item source does not work in silverlight datagrid

Combobox item source does not work in silverlight datagrid

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?

Answers & Comments...

Answer: 1

Currently ur combobox cant find the value coz it trying to find it in items(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/976231




No comments:

Post a Comment

Send us your comment related to the topic mentioned on the blog