【发布时间】:2018-12-12 23:17:11
【问题描述】:
我有 ControlTemplate 和 Grid 里面。但是我找不到任何方法可以在包含我的模板的控件中访问此 Grid :(
<Window.Resources>
<ControlTemplate TargetType="ContentControl" x:Key="CertificatesTable">
<Grid Margin="5">
...
</Grid>
</ControlTemplate>
</Window.Resources>
...
<Border Grid.Row="2" Grid.ColumnSpan="100" BorderThickness="1,0,1,1" BorderBrush="#99000000">
<ContentControl Name="Certificates1" Template="{StaticResource CertificatesTable}"/>
</Border>
<Border Grid.Row="4" Grid.ColumnSpan="100" BorderThickness="1,0,1,1" BorderBrush="#99000000">
<ContentControl Name="Certificates2" Template="{StaticResource CertificatesTable}"/>
</Border>
<Border Grid.Row="6" Grid.ColumnSpan="100" BorderThickness="1,0,1,1" BorderBrush="#99000000">
<ContentControl Name="Certificates3" Template="{StaticResource CertificatesTable}"/>
</Border>
...
【问题讨论】:
-
“访问”是什么意思。你想完成什么?
标签: c# wpf xaml controltemplate