简体   繁体   中英

How to set custom app bar button icons in windows 8

I want to set my own customs app bar icons which I downloaded . How can I set that this doesnot work

<AppBarButton x:Name="save" Click="save_Click" Label="Save" Icon="Assets/icon/1.png" />

Try adding it this way:

<AppBarButton Label="BitmapIcon" Click="AppBarButton_Click">
    <AppBarButton.Icon>
        <BitmapIcon UriSource="ms-appx:///Assets/icon/1.png"/>
    </AppBarButton.Icon>
</AppBarButton>

Check also if the path is correct and that the image is in the correct format to be displayed. You could also give a try using Blend to check if the image is working.

Go back to basics, by creating a button from scratch, and animating it with Blend. I spent days tweaking the code for custom buttons and never got it right. In the end I spent a morning doing the tutorials, and then I was moving ahead. Both of these are very good: Make a Styled Button in XAML for Universal Windows Apps and Custom Styles in XAML - Edit Button Style to Create Your Own Custom Style . The second one is targetted to phone apps, but with some minor changes at the start can be used for desktop – Stephen Hosking 20 secs ago edit

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM