2015-09-16 66 views
3

我在我的項目中使用了一個ContentDialog,用於在Windows 10上登錄彈出窗口。 當我在移動設備上運行此項目時,ContentDialog未全屏顯示,並且有一個最小填充element.On鍵盤是可見的(在例如關注要素文本框)存在鍵盤和內容對話框ContentDialog Windows 10 Mobile XAML - FullScreen - Padding

之間保證金對全屏任何解決方案如何?我設置屬性「FullSizeDesired」爲true,mas的問題是一樣的嗎?

有人幫助消除這樣的: - 填充 - 全屏

我的代碼是:

<ContentDialog 
    x:Class="ExampleApp.SignInContentDialog" 
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    xmlns:local="using:ExampleApp" 
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
    mc:Ignorable="d" 
    Title="SIGN IN"> 

    <Grid x:Name="GridMobile" VerticalAlignment="Center" HorizontalAlignment="Center"> 

      <Button x:Name="MakeOff" 
      Height="32" BorderThickness="1" 
      HorizontalAlignment="Center" 
      Foreground="Red" Background="Black" 
      Style="{StaticResource ButtonStyle}" 
      Margin="0"> 

      <HyperlinkButton x:Name="btnRegister" 
      Height="32" BorderThickness="1" 
      HorizontalAlignment="Center" 
      Foreground="Red" Background="Black" 
      Margin="0" 
      NavigateUri="www.google.pt" 
      Style="{StaticResource HyperLinkButtonStyleMobile}" 
      Content="Register"> 
       <HyperlinkButton.ContentTemplate> 
        <DataTemplate> 
        <TextBlock Text="{Binding}" /> 
        </DataTemplate> 
       </HyperlinkButton.ContentTemplate> 
      </HyperlinkButton> 
    </Grid> 

保證金/空間在頁面的按鈕則保留爲「PrimaryButton」和「SecondaryButton 「我認爲 但我需要更多的按鈕,這個邊際/空間不適合我。我想刪除這個。

謝謝。

+0

你可以顯示你自定義的'ContentDialog' xaml? –

+0

對不起,我不允許在這裏發佈圖片。 你可以給你的skypei身份證或其他與你溝通嗎? 我現在編輯這篇文章! 謝謝 – fipcurren88

+0

那麼,爲什麼你不能在這裏發佈你的代碼? –

回答

6

,你看到兩者之間的差距的原因是不是因爲任何具體Padding值,但由於ContentDialog的默認樣式,高度和寬度都設置爲Auto這意味着你的內容將只提供其所需的大小至。

因此,要使內容伸展以適合其父項,您只需要覆蓋默認樣式,方法是應用local:SignInContentDialog的默認樣式並將其放入App.xaml

<Style TargetType="local:SignInContentDialog"> 
    <Setter Property="Foreground" Value="{ThemeResource SystemControlPageTextBaseHighBrush}" /> 
    <Setter Property="Background" Value="{ThemeResource SystemControlBackgroundChromeMediumLowBrush}" /> 
    <Setter Property="HorizontalAlignment" Value="Center" /> 
    <Setter Property="VerticalAlignment" Value="Top" /> 
    <Setter Property="IsTabStop" Value="False" /> 
    <Setter Property="MaxHeight" Value="{ThemeResource ContentDialogMaxHeight}" /> 
    <Setter Property="MinHeight" Value="{ThemeResource ContentDialogMinHeight}" /> 
    <Setter Property="MaxWidth" Value="{ThemeResource ContentDialogMaxWidth}" /> 
    <Setter Property="MinWidth" Value="{ThemeResource ContentDialogMinWidth}" /> 
    <Setter Property="Template"> 
     <Setter.Value> 
      <ControlTemplate TargetType="local:SignInContentDialog"> 
       <Border x:Name="Container"> 
        <Grid x:Name="LayoutRoot">              
         <Grid.RowDefinitions> 
          <RowDefinition Height="Auto" /> 
         </Grid.RowDefinitions> 

         <!-- COMMENT OUT THESE FOLLOWING LINES --> 

         <!--<Grid.ColumnDefinitions> 
          <ColumnDefinition Width="Auto" /> 
         </Grid.ColumnDefinitions>--> 
         <Border x:Name="BackgroundElement" Background="{TemplateBinding Background}" FlowDirection="{TemplateBinding FlowDirection}" MaxWidth="{TemplateBinding MaxWidth}" MaxHeight="{TemplateBinding MaxHeight}" MinWidth="{TemplateBinding MinWidth}" MinHeight="{TemplateBinding MinHeight}"> 
          <Grid x:Name="DialogSpace" VerticalAlignment="Stretch"> 
           <Grid.RowDefinitions> 
            <RowDefinition Height="Auto" /> 
            <RowDefinition Height="*" /> 
            <RowDefinition Height="Auto" /> 
           </Grid.RowDefinitions> 
           <ScrollViewer HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Disabled" ZoomMode="Disabled" Margin="{ThemeResource ContentDialogContentScrollViewerMargin}" IsTabStop="False"> 
            <Grid> 
             <Grid.RowDefinitions> 
              <RowDefinition Height="Auto" /> 
              <RowDefinition Height="Auto" /> 
             </Grid.RowDefinitions> 
             <ContentControl x:Name="Title" Margin="{ThemeResource ContentDialogTitleMargin}" Content="{TemplateBinding Title}" ContentTemplate="{TemplateBinding TitleTemplate}" FontSize="20" FontFamily="Segoe UI" FontWeight="Normal" Foreground="{TemplateBinding Foreground}" HorizontalAlignment="Left" VerticalAlignment="Top" IsTabStop="False" MaxHeight="{ThemeResource ContentDialogTitleMaxHeight}"> 
              <ContentControl.Template> 
               <ControlTemplate TargetType="ContentControl"> 
                <ContentPresenter Content="{TemplateBinding Content}" MaxLines="2" TextWrapping="Wrap" ContentTemplate="{TemplateBinding ContentTemplate}" Margin="{TemplateBinding Padding}" ContentTransitions="{TemplateBinding ContentTransitions}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" /> 
               </ControlTemplate> 
              </ContentControl.Template> 
             </ContentControl> 
             <ContentPresenter x:Name="Content" ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Content}" FontSize="{ThemeResource ControlContentThemeFontSize}" FontFamily="{ThemeResource ContentControlThemeFontFamily}" Margin="{ThemeResource ContentDialogContentMargin}" Foreground="{TemplateBinding Foreground}" Grid.Row="1" TextWrapping="Wrap" /> 
            </Grid> 
           </ScrollViewer> 
           <Grid x:Name="CommandSpace" Grid.Row="1" HorizontalAlignment="Stretch" VerticalAlignment="Bottom"> 
            <Grid.ColumnDefinitions> 
             <ColumnDefinition /> 
             <ColumnDefinition /> 
            </Grid.ColumnDefinitions> 
            <Border x:Name="Button1Host" Margin="{ThemeResource ContentDialogButton1HostMargin}" MinWidth="{ThemeResource ContentDialogButtonMinWidth}" MaxWidth="{ThemeResource ContentDialogButtonMaxWidth}" Height="{ThemeResource ContentDialogButtonHeight}" HorizontalAlignment="Stretch" /> 
            <Border x:Name="Button2Host" Margin="{ThemeResource ContentDialogButton2HostMargin}" MinWidth="{ThemeResource ContentDialogButtonMinWidth}" MaxWidth="{ThemeResource ContentDialogButtonMaxWidth}" Height="{ThemeResource ContentDialogButtonHeight}" Grid.Column="1" HorizontalAlignment="Stretch" /> 
           </Grid> 
          </Grid> 
         </Border> 
        </Grid> 
       </Border> 
      </ControlTemplate> 
     </Setter.Value> 
    </Setter> 
</Style> 
+0

好的,但是,我將這種樣式複製到App.xaml。 Visual Studio顯示錯誤「未知目標類型」local:SignInContentDialog'「。 幫我解決這個問題。 – fipcurren88

+0

您需要使用:YourNamespaceName「'在頂部定義名稱空間 - 」xmlns:local =「。 –

+0

輸入「xmlns:local =」使用:SignInContentDialog「? – fipcurren88

相關問題