2016-06-28 56 views
0

我想要一個「類似Snapchat」的UWP應用程序。類似Snapchat的應用程序

這裏是一個小的一段代碼:

<Grid> 
      <CaptureElement Stretch="Uniform"/> 
      <Button 
        x:Name="button1" 
        Content="Button" 
        Height="126" Width="162" 
        Click="button1_Click" 
        FontSize="72" 
        Margin="185,543,0,51"/> 

</Grid> 

不過,我想我的應用程序能夠在手機和桌面使用的,我希望能夠調整窗口的大小,讓它(使用VisualStateManager)自動調整

我試着用行來實現這一目標:

<Grid> 
    <Grid.RowDefinitions> 
     <RowDefinition Height="*"/> 
     <RowDefinition Height="Auto"/> 
    </Grid.RowDefinitions> 

    <CaptureElement Stretch="Uniform" Grid.Row="0"/> 
    <Button 
      x:Name="button1" 
      Content="Button" 
      Height="126" Width="162" 
      Click="button1_Click" 
      FontSize="12" 
      Grid.Row="1"/> 

</Grid> 

這似乎是確定,但圖片不是全屏 - 你可以清楚地將Button從CapturePreview中分離出來,但想法是隻用按鈕圖標進行全屏預覽。

有沒有一種方法可以實現我的想法?

+1

Can''解決問題? –

+0

@ GraceFeng-MSFT你會添加到第一個代碼或第二個? –

+0

@ GraceFeng-MSFT謝謝,實際上使圖標可見,但現在captureElement已伸出。 –

回答

1

您可以在這裏設置Grid.RowSpanProperty property

既然你把你的Grid分爲兩部分:如果你希望你的CaptureElement伸展到整個Grid

<Grid.RowDefinitions> 
    <RowDefinition Height="*"/> 
    <RowDefinition Height="Auto"/> 
</Grid.RowDefinitions> 

,您可以設置Grid.RowSpan="2"這裏:

<CaptureElement Stretch="Uniform" Grid.Row="0" Grid.RowSpan="2"/>

由如果您有關於相機的其他問題,可以參考官方Basic camera app sample

相關問題