0

ActualWidthofStretchingGrid始终为 0。我尝试了很多在这里找到的解决方案 ( UpdateLayout(),....),但没有一个对我有用。

<Grid x:Name="StretchingGrid" HorizontalAlignment="Stretch" Background="Red">
         <Grid x:Name="GridMenu" HorizontalAlignment="Left" Background="LightBlue" Width="30">

         </Grid>
    </Grid>


    <Storyboard x:Key="OpenMenu">
         <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(FrameworkElement.Width)" Storyboard.TargetName="GridMenu">
                            <EasingDoubleKeyFrame KeyTime="0" Value="30"/>
                            <EasingDoubleKeyFrame KeyTime="0:0:0.5" Value="{Binding ActualWidth, ElementName=StretchingGrid}"/>
         </DoubleAnimationUsingKeyFrames>
    </Storyboard>
4

0 回答 0