所以我有这个Grid
:
<Grid.ColumnDefinitions>
<ColumnDefinition x:Name="IsSelectedColumnDefinition" Width="0"/>
<ColumnDefinition Width="60"/>
<ColumnDefinition Width="780"/>
<ColumnDefinition Width="60"/>
</Grid.ColumnDefinitions>
此Grid
在DataTemplate
内部:
<GridViewColumn>
<GridViewColumn.CellTemplate>
<DataTemplate>
// MY GRID
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
因此,如您所见,我有这个x:Name="IsSelectedColumnDefinition"
,但仍然无法从后面的代码中获取。
我要做的就是从我的Storyboard
点击Button
开始Event
:
<Storyboard x:Key="EnlargeWidth">
<DoubleAnimation Storyboard.TargetProperty="Height"
From="0" To="30"
DecelerationRatio=".9"
Duration="0:0:0.3" />
</Storyboard>
private void toggleButtonEnableOptions_Checked(object sender, RoutedEventArgs e)
按钮事件
{
Storyboard storyboard = Resources["IsSelectedGrigWidth"] as Storyboard;
if (storyboard != null)
storyboard.Begin(IsSelectedColumnDefinition); // HERE i cannot reach this **IsSelectedColumnDefinition**
}