Wp 8.1 xaml问题

时间:2015-12-16 13:26:07

标签: xaml windows-phone-8.1

我将TemplatedControl定义为:

<Style TargetType="controls:HeaderedContentControl">
        <Setter Property="HintAlignment" Value="Center"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="controls:HeaderedContentControl">
                    <Grid Background="{TemplateBinding Background}">
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto"/>
                            <RowDefinition/>
                        </Grid.RowDefinitions>
                        <Border Background="Gray">
                            <TextBlock Text="{TemplateBinding Header}"
                                       FontSize="25"
                                       Foreground="White"
                                       TextWrapping="Wrap" 
                                       Margin="0,10"
                                       HorizontalAlignment="Center"
                                       VerticalAlignment="Center"/>
                        </Border>
                        <ScrollViewer Grid.Row="1">
                            <Grid>
                                <Grid.RowDefinitions>
                                    <RowDefinition Height="Auto"/>
                                    <RowDefinition/>
                                </Grid.RowDefinitions>
                                <TextBlock Visibility="{Binding Text, RelativeSource={RelativeSource Self}, Converter={StaticResource strConv}}"
                                   Text="{TemplateBinding Hint}"
                                   TextAlignment="{TemplateBinding HintAlignment}"
                                   TextWrapping="Wrap"
                                   Foreground="Gray"
                                   FontSize="17"
                                   Margin="10"/>
                                <ContentPresenter Content="{TemplateBinding Content}"
                                                  Grid.Row="1"/>
                            </Grid>
                        </ScrollViewer>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

有时导航到带有此控件的页面后,我看到了 this

而不是 this

我认为这是因为页面上的BottomAppBar。我怎样才能解决这个问题?

使用此控件的布局:

<controls:HeaderedContentControl Header="Регистрация">
    <StackPanel Margin="10,40">
        <TextBlock Text="Номер телефона:"
                   FontSize="20"/>
        <Grid Margin="0,15">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto"/>
                <ColumnDefinition/>
            </Grid.ColumnDefinitions>
            <TextBlock Text="8"
                       Margin="10,0"
                       VerticalAlignment="Center"
                       FontSize="20"/>
            <controls:PhoneTextBox Value="{Binding PhoneNumber, Mode=TwoWay}"
                                   AddContactVisibility="Collapsed"
                                   Margin="0"
                                   Grid.Column="1"/>
        </Grid>
        <TextBlock Text="Номер вводится без 8-ки. Пример: (XXX)XXX-XX-XX"
                   FontSize="15"
                   Foreground="Gray"
                   TextWrapping="WrapWholeWords"/>
    </StackPanel>
</controls:HeaderedContentControl>

<Page.BottomAppBar>
    <CommandBar>
        <AppBarButton Label="Далее"
                      Icon="Accept"
                      Command="{Binding RegisterCommand}"/>
    </CommandBar>
</Page.BottomAppBar>

0 个答案:

没有答案