1

So i have this Grid:

<Grid.ColumnDefinitions>


<ColumnDefinition x:Name="IsSelectedColumnDefinition" Width="0"/>
                                                                                    <ColumnDefinition Width="60"/>
                                                                                    <ColumnDefinition Width="780"/>
                                                                                    <ColumnDefinition Width="60"/>
                                                                                </Grid.ColumnDefinitions>

This Grid is inside DataTemplate:

<GridViewColumn>                                                          
    <GridViewColumn.CellTemplate>
        <DataTemplate>
             // MY GRID
        </DataTemplate>
    </GridViewColumn.CellTemplate>
</GridViewColumn>

So as you can see i have this x:Name="IsSelectedColumnDefinition" but still from code behind i cannot reach it.

All i want to do is start this Storyboard from my Button click 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)

Button Event

{
    Storyboard storyboard = Resources["IsSelectedGrigWidth"] as Storyboard;
        if (storyboard != null)
            storyboard.Begin(IsSelectedColumnDefinition); // HERE i cannot reach this **IsSelectedColumnDefinition**
}
Clemens
  • 123,504
  • 12
  • 155
  • 268
falukky
  • 1,099
  • 2
  • 14
  • 34
  • Possible duplicate of [How can I dynamically add a RowDefinition to a Grid in an ItemsPanelTemplate?](https://stackoverflow.com/questions/9000549/how-can-i-dynamically-add-a-rowdefinition-to-a-grid-in-an-itemspaneltemplate) – Bizhan Jul 21 '18 at 11:24
  • I do not have this GridHelpers after local: (xmlns:local="clr-namespace:ApplicationName") – falukky Jul 21 '18 at 11:29
  • You need to add the source code to your project. it is provided in the answer. One more thing, these two questions are a bit different but I marked it as a duplicate because their solutions are the same (which is: there is no way to reach it and you need a grid helper to do it for you). – Bizhan Jul 21 '18 at 11:46
  • What source code ? – falukky Jul 21 '18 at 11:53
  • http://rachel53461.wordpress.com/2011/09/17/wpf-grids-rowcolumn-count-properties/ it is provided in the answer. – Bizhan Jul 21 '18 at 11:57

0 Answers0