Assuming that I have an arbitrary control inside a DataGridTemplateColumn, I wish to know how to get the control, given that I have retrieved the DataGridCell which contains that control.
My XAML file containing the DataGrid is as follows:
<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 retrieved the DataGridCell using extension methods as follows:
DataGridCell cell = view.dgMovement2.GetCell(index, 6);
The extension methods, contained in a static class is found here
The question is, how to I retrieve the "PercentageEditor", once I got the DataGridCell? Can anybody help me? Any help would be greatly appreciated. Thanks!
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…