2014-01-05 64 views
0

我有一個網格和兩個stackpanels.I已經使混合動畫在設置門時出現了不同的分辨率。 這是我的代碼,在1024,768分辨率下工作正常。使用xaml和c在windows 8應用程序中創建一個門#

 <StackPanel.Background> 
      <ImageBrush ImageSource="Assets/left.jpg"></ImageBrush> 
     </StackPanel.Background> 
    </StackPanel> 

    <StackPanel x:Name="stackPanel1" Width="512" Height="{Binding ElementName=mygrid,Path=ActualHeight}" HorizontalAlignment="Right"> 

     <StackPanel.Background> 
      <ImageBrush ImageSource="Assets/right.jpg"></ImageBrush> 
     </StackPanel.Background> 
    </StackPanel> 

</Grid>`` 

回答

0

試試這個

<Grid> 
    <Grid.ColumnDefinitions> 
     <ColumnDefinition></ColumnDefinition> 
     <ColumnDefinition></ColumnDefinition> 
    </Grid.ColumnDefinitions> 

    <!--used for calculating height and width of door--> 
    <Grid x:Name="Door" Grid.Column="0" ></Grid> 

    <StackPanel Grid.ColumnSpan="2" x:Name="stackPanel1" Width="{Binding ElementName=Door,Path=ActualWidth}" Height="{Binding ElementName=Door,Path=ActualHeight}" HorizontalAlignment="Left"> 
     <StackPanel.Background> 
      <ImageBrush ImageSource="Assets/left.jpg" Stretch="Fill"></ImageBrush> 
     </StackPanel.Background> 
    </StackPanel> 
    <StackPanel Grid.ColumnSpan="2" x:Name="stackPanel2" Width="{Binding ElementName=Door,Path=ActualWidth}" Height="{Binding ElementName=Door,Path=ActualHeight}" HorizontalAlignment="Right"> 
     <StackPanel.Background> 
      <ImageBrush ImageSource="Assets/right.jpg" Stretch="Fill"></ImageBrush> 
     </StackPanel.Background> 
    </StackPanel> 
</Grid> 
+0

圖像不顯示 – user3160438

+0

運行這段代碼separately..images可見。 –

+0

雅虎工作非常感謝:D – user3160438

相關問題