Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
2370
Binding not working in DataTemplate
posted

I have a XamDataGrid where I'm trying to bind the ItemsSource for a XamMultiColumnComboEditor that gets created when the user enters edit mode.  The dropdown values are dependent on things in other cells, so I have to take care of it in the code behind.

I assign the DataTemplates below in the FieldLayoutInitialized method.  All is working except the binding to the ItemsSource.

<DataTemplate x:Key="DisplayTemplateKey">

<TextBlock Text="{editors:TemplateEditorValueBinding}" />
</DataTemplate>
<DataTemplate x:Key="EditTemplateKey">
<ig:XamMultiColumnComboEditor ItemsSource="{Binding DropdownValues}"
DisplayMemberPath="Value"
DropDownButtonDisplayMode="MouseOver"
CustomValueEnteredAction="Allow"
EmptyText="Choose level..."
SelectedItemsResetButtonVisibility="Collapsed"
MinDropDownWidth="300" />
</DataTemplate>

There are not any binding errors in the output window, but the values are not shown.

DropdownValues is an IEnumerable of a simple data wrapper that just has a String Value in it.  I am implementing INotifyPropertyChanged and calling RaisePropertyChanged on the setter for DropdownValues.

I have done Binding inside a DataTemplate before so I'm not sure why this is not working.  The templates are defined in my UserControl's Resources block, maybe that is causing issues?  

I tried moving the DataTemplates to the XamDataGrid Resources block or even the Grid Resources above that with no success (couldn't find resources from code behind).

Any help would be greatly appreciated.

Parents Reply Children
No Data