Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Toolkit] IconSource support #164

Open
kazo0 opened this issue Dec 3, 2021 · 2 comments
Open

[Toolkit] IconSource support #164

kazo0 opened this issue Dec 3, 2021 · 2 comments
Assignees

Comments

@kazo0
Copy link
Contributor

kazo0 commented Dec 3, 2021

No description provided.

@kazo0
Copy link
Contributor Author

kazo0 commented Dec 3, 2021

Ideally, we would be able to have shared resources for IconElements to be able to have default icons present in the MaterialNavigationBarStyle.

One path is to implement IconSourceElement in Uno. The problem is that because of this issue we will have a blocker for PathIcon/PathIconSource being shared in a style

@kazo0 kazo0 self-assigned this Dec 3, 2021
@kazo0
Copy link
Contributor Author

kazo0 commented Dec 3, 2021

Ex:

<Page x:Class="App1.MainPage"
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
      xmlns:local="using:App1"
      xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
      Background="{ThemeResource ApplicationPageBackgroundThemeBrush}"
      mc:Ignorable="d">
    <Page.Resources>
        <IconSourceElement x:Key="MyIconSourceElement">
            <IconSourceElement.IconSource>
                <PathIconSource Data="PATH DATA HERE" />
            </IconSourceElement.IconSource>
        </IconSourceElement>
        <Style x:Key="MyAppBarButtonStyle"
               TargetType="AppBarButton">
            <Setter Property="Icon" Value="{StaticResource MyIconSourceElement}" />
        </Style>
    </Page.Resources>
    <Grid>
        <StackPanel>
            <AppBarButton Style="{StaticResource MyAppBarButtonStyle}" />
            <AppBarButton Style="{StaticResource MyAppBarButtonStyle}" />
            <AppBarButton Style="{StaticResource MyAppBarButtonStyle}" />
            <AppBarButton Style="{StaticResource MyAppBarButtonStyle}" />
        </StackPanel>
    </Grid>
</Page>

This causes an exception on Windows

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant