Friday, 23 August 2013

Change CellEditingTemplate based on value

Change CellEditingTemplate based on value

I have found myself stuck with some xaml. I am looking to dynamically
change the cellEditTemplate based on another value in the row. So if the
users add in a type of x then the next cell should be a drop down If you
enters y then it should be plain old textbox. Here's what I have got to.
<DataGridTemplateColumn.CellEditingTemplate>
<DataTemplate>
<TextBlock Text="{Binding RC_Qty}"/>
<DataTemplate.Triggers>
<DataTrigger Binding="{Binding Path = RC_Type}" Value
="OFN (ltrs)">
<ComboBox Height="20" Name="cboQty">
<ComboBoxItem Content="0.25"/>
<ComboBoxItem Content="0.5"/>
<ComboBoxItem Content="0.75"/>
<ComboBoxItem Content="1"/>
</ComboBox>
</DataTrigger>
</DataTemplate.Triggers>
</DataTemplate>
</DataGridTemplateColumn.CellEditingTemplate>
Hopefully someone can point me in the right direction. Thanks in advance
Scott

No comments:

Post a Comment