TabbedPage with icons in UWP

0

Good morning, I tried to place icons to my UWP app but they did not show me someone could help me create a styles file '

<local:IconConverter x:Key="IconConverter" />

<Style x:Key="TabbedPageStyle2" TargetType="uwp:FormsPivot">
    <Setter Property="HeaderTemplate">
        <Setter.Value>
            <DataTemplate>
                <StackPanel Orientation="Vertical">
                    <Image Source="{Binding Icon, Converter={StaticResource IconConverter}}" Width="15" Height="15" />
                    <TextBlock Name="TabbedPageHeaderTextBlock" Text="{Binding Title}"
                               Style="{ThemeResource BodyTextBlockStyle}" />
                </StackPanel>
            </DataTemplate>
        </Setter.Value>
    </Setter>
</Style>

' Also the IconConverter

 public class IconConverter : IValueConverter
{
    public object Convert(object value, Type targetType, object parameter, string language)
    {
        if (value != null && value is Xamarin.Forms.FileImageSource)
            return ((Xamarin.Forms.FileImageSource)value).File;

        return null;
    }

    public object ConvertBack(object value, Type targetType, object parameter, string language)
    {
        throw new NotImplementedException();
    }

And add this line in the app

 ((Style)this.Resources["TabbedPageStyle"]).Setters[0] = ((Style)this.Resources["TabbedPageStyle2"]).Setters[0];
    
asked by juandah 02.01.2018 в 14:11
source

1 answer

0

The problem I had was that I was not putting the extension of the image. 'TabbedPage xmlns="http://xamarin.com/schemas/2014/forms"             xmlns: x="http://schemas.microsoft.com/winfx/2009/xaml"             x: Class="Dlp.CustomerApps.MainPage"
            BarBackgroundColor="# 2196F3"
            BarTextColor="# ffffff"

        >

                                                                                                        ' For Andorid it is not necessary to file extension for UWP if.

    
answered by 18.01.2018 / 15:58
source