Assuming I have an arbitrary control inside a DataGridTemplateColumn, I want to know how to get the control, given that I got a DataGridCell that contains this control.
My XAML file containing the DataGrid looks like this:
<DataGrid Name="dgMovement"> ... <DataGridTemplateColumn Header="Target %"> <DataGridTemplateColumn.CellTemplate> <DataTemplate> <vi:PercentageEditor Value="{Binding TargetPercentage, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Width="100px" cal:Message.Attach="[Event PreviewLostKeyboardFocus] = [Action ChangeTargetPercentage];[Event PreviewGotKeyboardFocus] = [Action OnFocus]" Name="aa" /> </DataTemplate> </DataGridTemplateColumn.CellTemplate> </DataGridTemplateColumn>...
I extracted the DataGridCell using extension methods as follows:
DataGridCell cell = view.dgMovement2.GetCell(index, 6);
Extension methods contained in a static class are found here.
The question is, how do I get a "PercentageEditor" once I get a DataGridCell? Can anybody help me? Any help would be greatly appreciated. Thanks!
bluebloodedboy
source share