【发布时间】:2023-03-20 08:13:01
【问题描述】:
我正在尝试获取 DataGridColumn 的 x:Name。 DataGridColumn 直接从 DependencyObject 派生,因此我无法将其转换为 FrameworkElement 并使用 Name 属性。
这是我在 XAML 中的代码:
<toolkit:DataGridCheckBoxColumn Header="Abgerechnet" x:Name="DataGridColumAbgerechnet" />
现在我想通过 x:Name 在 DataGrid 中找到此列。
我该怎么做?
【问题讨论】:
-
你在哪里尝试使用它,在 xaml.cs 中它应该在你这样做时直接可用。DataGridColumAbgerechnet
-
我有一个函数将 DataGrid 作为 DependencyObject,但不在 xaml.cs 文件中。