Vil
Vil

Reputation: 89

Windows Phone 8.1 RT - AppBarButton icon problems

I'm rendering Bitmap from Xaml snippet using: https://stackoverflow.com/a/26184524/3853371 . Bitmap renders fine but when I try to set it as AppBarButton icon I get this: enter image description here

Rendered Image is made from Grid with 2 TextBlocks and it's not a rounded rectangle with an X in the middle.

<Grid x:Name="TodayIconImage" Height="41" Width="41">
      <TextBlock x:Name="dayTextBlock" Text="12" Style="{ThemeResource MessageDialogTitleStyle}"  FontSize="20" HorizontalAlignment="Center" Margin="0,0,0,0"/>
      <TextBlock x:Name="monthTextBlock" Text="Feb" Style="{ThemeResource MessageDialogContentStyle}" FontSize="12" HorizontalAlignment="Center" Margin="0,20,0,0"/>
</Grid>

Upvotes: 1

Views: 371

Answers (1)

Rob Caplan - MSFT
Rob Caplan - MSFT

Reputation: 21889

That is what I'd expect if your original xaml is a rounded rectangle with an X in the middle. The circle border is added automatically and is not optional. For an X icon you can use the standard Cancel symbol. If you want a rectangular button then you can't use an AppBar but will need to create a custom UI.

You should use a solid-on-transparent image with the icon centred and enough padding for the AppBarButton's circle. The 240% scale version should have an 41x41 pixel icon with 18 pixels padding on all sides (see Details on sizing, padding, scaling, and transparency for Windows Phone Store apps in the Guidelines for app bars)

If your overall bitmap size is too large then it will be scaled down to fit. The padding still needs to be proportional.

Upvotes: 1

Related Questions