2017-09-26 60 views
0

我想爲visual studio錄製混合中的狀態,但是當我爲某個狀態調整窗口大小(網格和製表控件)時,整個內容將會失真。如果我不記錄,那麼它將表現正常。形式在錄製狀態時調整wpf窗口的大小,使wpf組件變形

enter image description here

enter image description here 基地狀態這是發生了什麼,當我調整

這裏是XAML代碼

<Window x:Name="window" x:Class="WpfApp2.MainWindow" 
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
    xmlns:local="clr-namespace:WpfApp2" 
    mc:Ignorable="d" 
    Title="MainWindow" Height="208" Width="220"> 

<Grid x:Name="grid" HorizontalAlignment="Left" Width="213" Margin="0,0,-1,0" RenderTransformOrigin="0.5,0.5"> 

    <Grid.RenderTransform> 
     <TransformGroup> 
      <ScaleTransform/> 
      <SkewTransform/> 
      <RotateTransform/> 
      <TranslateTransform/> 
     </TransformGroup> 
    </Grid.RenderTransform> 

    <VisualStateManager.VisualStateGroups> 
     <VisualStateGroup x:Name="VisualStateGroup"> 
      <VisualStateGroup.Transitions> 
       <VisualTransition From="big" GeneratedDuration="0:0:1"/> 
      </VisualStateGroup.Transitions> 
      <VisualState x:Name="big"> 
       <Storyboard> 
        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(FrameworkElement.Width)" Storyboard.TargetName="window"> 
         <EasingDoubleKeyFrame KeyTime="0" Value="339"/> 
        </DoubleAnimationUsingKeyFrames> 
        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleX)" Storyboard.TargetName="grid"> 
         <EasingDoubleKeyFrame KeyTime="0" Value="1.549"/> 
        </DoubleAnimationUsingKeyFrames> 
        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.X)" Storyboard.TargetName="grid"> 
         <EasingDoubleKeyFrame KeyTime="0" Value="58.5"/> 
        </DoubleAnimationUsingKeyFrames> 
        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleX)" Storyboard.TargetName="tabControl"> 
         <EasingDoubleKeyFrame KeyTime="0" Value="1.33"/> 
        </DoubleAnimationUsingKeyFrames> 
        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.X)" Storyboard.TargetName="tabControl"> 
         <EasingDoubleKeyFrame KeyTime="0" Value="35.184"/> 
        </DoubleAnimationUsingKeyFrames> 
       </Storyboard> 
      </VisualState> 
     </VisualStateGroup> 
    </VisualStateManager.VisualStateGroups> 

    <TabControl x:Name="tabControl" SelectionChanged="changes" Height="177" VerticalAlignment="Top" RenderTransformOrigin="0.5,0.5"> 

     <TabControl.RenderTransform> 
      <TransformGroup> 
       <ScaleTransform/> 
       <SkewTransform/> 
       <RotateTransform/> 
       <TranslateTransform/> 
      </TransformGroup> 
     </TabControl.RenderTransform> 

     <TabItem Header="TabItem" Name="tab1"> 
      <TextBlock HorizontalAlignment="Center" TextWrapping="Wrap" VerticalAlignment="Center" Width="163.126" Height="55.88" Text="apple cat bol dog gellephant this is sample only"/> 

     </TabItem> 
     <TabItem Header="TabItem" Name="tab2"> 
     </TabItem> 
    </TabControl> 

</Grid> 

請幫助。任何幫助將非常感激。

+1

您可以使用alt + printscreen截取聚焦窗口的截圖,或使用mspaint進行裁剪。沒有人需要在它前面有一個小窗口的IDE的兩個巨大屏幕截圖。在我的手機上,我甚至無法將這兩者分開。 –

+0

這只是爲了瞭解發生了什麼..但我會在下次記住這一點..對不起 –

+0

_「我想記錄混合狀態」_ - 請更具體。你怎麼樣,「記錄混合狀態」?你究竟做了什麼? –

回答

0

我自己找到答案。

代替

<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleX)" Storyboard.TargetName="grid"> 
        <EasingDoubleKeyFrame KeyTime="0" Value="1.549"/> 
</DoubleAnimationUsingKeyFrames> 

我不得不使用

<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(FrameworkElement.Width)" Storyboard.TargetName="grid"> 
         <EasingDoubleKeyFrame KeyTime="0" Value="909"/> 
</DoubleAnimationUsingKeyFrames> 

我曾與FrameworkElement的,而不是UI元素的工作。

相關問題