InfoBar FontSize cannot be changed

Viewed 52

No changes occur when you try to change the font size of the Message property of the InfoBar class with the FontSize property.

Problem

Font size has not changed

Source Code

<InfoBar
   Severity="Warning"
   IsOpen="True"
   FontSize="50"
   Title="Data Requests"
   Message="This is a test. FontSize at 50" >
</InfoBar>
1 Answers

This was a messy workaround that I tried and looks like it works, somehow.

Edited Bar

<InfoBar x:Name="Notification"
    IsOpen="true">
    <InfoBar.Content>
        <TextBlock 
            Text="Hello, world!"
            Margin="0,-50,0,0"
            FontSize="50"
        />
    </InfoBar.Content>
</InfoBar>

You can add custom contents inside your bar. As you can see, I added a TextBlock and applied the changes. It works well with the icon and with the close button. If you want to add more TextBlocks or other Components, you will have to work with the style.

In this example, I created a negative margin on top, so the block could move up, aligned to the bar icon and close button.

Related