11

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" />
user3090763
  • 1,089
  • 1
  • 10
  • 24

2 Answers2

25

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.

Saverio Terracciano
  • 3,885
  • 1
  • 30
  • 42
  • I am doing it in this manner but my image is pixelated, I have used images of size mentioned in this answer http://stackoverflow.com/questions/28935766/appbar-button-icon-not-fitting-inside-elipse – Yawar Sep 29 '15 at 07:13
  • I think this may be the wrong question to ask about it. Anyhow, what's your image size? – Saverio Terracciano Sep 29 '15 at 08:46
  • see the image in answer of the question – Yawar Sep 29 '15 at 09:04
0

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

Stephen Hosking
  • 1,405
  • 16
  • 34