none
Cambiar tamaño fuente en pivot page RRS feed

  • Pregunta

  • Muy buenas, quiero cambiar el tamaño de la fuente en un XAML con pivot page loi he intentado de esta manera como pongro aqui en el pivot page.

    Quiero cambiar el tamaño del texto de los pivotitem y del <phone:Pivot Title="GPSFinder" FontSize="12">, ademas de cambiar un poco la posicion un poco mas arriba para tener mas espacio, gracias.

    <phone:PhoneApplicationPage
        x:Class="GPSFinderPerson.MainPage"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
        xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        mc:Ignorable="d"
        d:DataContext="{d:DesignData SampleData/MainViewModelSampleData.xaml}"
        FontFamily="{StaticResource PhoneFontFamilyNormal}"
        FontSize="{StaticResource PhoneFontSizeNormal}"
        Foreground="{StaticResource PhoneForegroundBrush}"
        SupportedOrientations="Portrait"  Orientation="Portrait"
        shell:SystemTray.IsVisible="True" Loaded="PhoneApplicationPage_Loaded">

        <!--LayoutRoot is the root grid where all page content is placed-->
        <Grid x:Name="LayoutRoot" Background="Transparent">

            <!-- LOCALIZATION NOTE:
                To localize the displayed strings copy their values to appropriately named
                keys in the app's neutral language resource file (AppResources.resx) then
                replace the hard-coded text value between the attributes' quotation marks
                with the binding clause whose path points to that string name.

                For example:

                    Text="{Binding Path=LocalizedResources.ApplicationTitle, Source={StaticResource LocalizedStrings}}"

                This binding points to the template's string resource named "ApplicationTitle".

                Adding supported languages in the Project Properties tab will create a
                new resx file per language that can carry the translated values of your
                UI strings. The binding in these examples will cause the value of the
                attributes to be drawn from the .resx file that matches the
                CurrentUICulture of the app at run time.
             -->

            <!--Pivot Control-->
            <phone:Pivot Title="GPSFinder" FontSize="12">
                <!--Pivot item one-->
                <phone:PivotItem x:Name="PivotMain" Header="Main" FontSize="12">
                    <!--Double line list with text wrapping-->
                    <phone:LongListSelector Margin="0,-23,-12,0" ItemsSource="{Binding Items}">
                        <phone:LongListSelector.ItemTemplate>
                            <DataTemplate>
                                <StackPanel Margin="0,0,0,17">
                                    <TextBlock Text="{Binding LineOne}" TextWrapping="Wrap" Style="{StaticResource PhoneTextExtraLargeStyle}"/>
                                    <TextBlock Text="{Binding LineTwo}" TextWrapping="Wrap" Margin="12,-6,12,0" Style="{StaticResource PhoneTextSubtleStyle}"/>
                                </StackPanel>
                            </DataTemplate>
                        </phone:LongListSelector.ItemTemplate>
                    </phone:LongListSelector>
                </phone:PivotItem>

                <!--Pivot item two-->
                <phone:PivotItem Header="second" x:Name="Second">
                    <!--Double line list no text wrapping-->
                    <phone:LongListSelector Margin="0,0,-12,0" ItemsSource="{Binding Items}">
                        <phone:LongListSelector.ItemTemplate>
                                <DataTemplate>
                                    <StackPanel Margin="0,0,0,17">
                                        <TextBlock Text="{Binding LineOne}" TextWrapping="NoWrap" Margin="12,0,0,0" Style="{StaticResource PhoneTextExtraLargeStyle}"/>
                                        <TextBlock Text="{Binding LineThree}" TextWrapping="NoWrap" Margin="12,-6,0,0" Style="{StaticResource PhoneTextSubtleStyle}"/>
                                    </StackPanel>
                                </DataTemplate>
                        </phone:LongListSelector.ItemTemplate>
                    </phone:LongListSelector>
                </phone:PivotItem>
            </phone:Pivot>

            <!--Uncomment to see an alignment grid to help ensure your controls are
                aligned on common boundaries.  The image has a top margin of -32px to
                account for the System Tray. Set this to 0 (or remove the margin altogether)
                if the System Tray is hidden.

                Before shipping remove this XAML and the image itself.-->
            <!--<Image Source="/Assets/AlignmentGrid.png" VerticalAlignment="Top" Height="800" Width="480" Margin="0,-32,0,0" Grid.Row="0" IsHitTestVisible="False" />-->
        </Grid>

    </phone:PhoneApplicationPage>

    martes, 27 de mayo de 2014 14:49

Respuestas

  • Debes cambiar cada uno de los elementos dentro del PivotItem para que estos surtan efecto, ya que aunque modifiques el PivotItem, los elementos de dentro tienen propiedades de tamaño de texto propias y sobrescribirán estos.

    Por tanto debes añadir a los TextBlock la propiedad FontSize="12".

    lunes, 7 de julio de 2014 13:23