In my scenario I have a column that can have a ComboBox or a TextBox and it's defined in the following way:
My templateSelectors are defined here:
The problem is that comboBoxSource can be changed in code depending on the value selected in another column and I'm not sure how to properly bind the source of that combobox. Any help is highly appreciated. Thanks!
<
telerik:GridViewDataColumn
Header
=
"Target"
DataMemberBinding
=
"{Binding Target}"
Width
=
"70"
ValidatesOnDataErrors
=
"None"
CellEditTemplateSelector
=
"{StaticResource TargetEditStyleSelector}"
/>
My templateSelectors are defined here:
<
UserControl.Resources
>
<
templateSelectors:TargetCellEditTemplateSelector
x:Key
=
"TargetEditStyleSelector"
>
<
templateSelectors:TargetCellEditTemplateSelector.TextBoxTemplate
>
<
DataTemplate
>
<
TextBox
Text
=
"{Binding Path=Target, Mode=TwoWay}"
HorizontalAlignment
=
"Stretch"
/>
</
DataTemplate
>
</
templateSelectors:TargetCellEditTemplateSelector.TextBoxTemplate
>
<
templateSelectors:TargetCellEditTemplateSelector.ComboBoxTemplate
>
<
DataTemplate
>
<
ComboBox
DisplayMemberPath
=
"Name"
SelectedValue
=
"Id"
ItemsSource
=
"{Binding Source={StaticResource comboBoxSource}}"
/>
</
DataTemplate
>
</
templateSelectors:TargetCellEditTemplateSelector.ComboBoxTemplate
>
</
templateSelectors:TargetCellEditTemplateSelector
>
</
UserControl.Resources
>
The problem is that comboBoxSource can be changed in code depending on the value selected in another column and I'm not sure how to properly bind the source of that combobox. Any help is highly appreciated. Thanks!