ComboBox in DataGrid,I cann't Bind data to the combobox

May 13, 2013 at 8:19 AM
Edited May 13, 2013 at 8:22 AM
Hi,Thank you for developing this powerful framework.
i want to bind CustomerCategories that is a property in viewmodel to a combobox that the combox is in datagrid(combobox is a column):
<DataGrid ItemsSource="{Binding Customers}">
        <DataGrid.Columns>
            <DataGridTemplateColumn   Header="CustomerCategory" >
                <DataGridTemplateColumn.CellTemplate>
                    <DataTemplate>
                        <ComboBox ItemsSource="{Binding DataContext.CustomerCategories}" 
            DisplayMemberPath="Name"
            SelectedValuePath="Code"
SelectedValue="CustomerCategoryID">
                        </ComboBox>
                    </DataTemplate>
                </DataGridTemplateColumn.CellTemplate>
            </DataGridTemplateColumn>
.........
but when i run the project ComboBoxcolumn does not show any data.
it does not show CustomerCategories. it worked in a simple mvvm application but here no...
thanks in advance...
Coordinator
May 16, 2013 at 10:23 PM
Do you see any binding errors being displayed in the output window?

Try changing the binding expression from {Binding DataContext.CustomerCategories} to just {Binding CustomerCategories}


Markus
May 27, 2013 at 10:49 PM
Edited May 27, 2013 at 10:50 PM
Thank you to answering my question.
i dont see any error it just does not show the data.unfortunately i left this framework due to the poor documentation.also I can not do lots of works with this framework.
changing the binding expression was not successful.
Thank you...
Coordinator
Jun 2, 2013 at 8:23 PM
There is quite a bit of documentation for this stuff, but it isn't a CODE Framework issue. What you are struggling with here is a WPF binding issue, so the WPF documentation is the right place to look for this.

Bindings are generally hard to debug (WPF or otherwise). They are great when they work, but you can't set a breakpoint or anything like that when they do not. There are a few other tricks you can use however. Take a look at this article to get some ideas: http://blogs.msdn.com/b/wpfsldesigner/archive/2010/06/30/debugging-data-bindings-in-a-wpf-or-silverlight-application.aspx


Markus