Windows 10 Dev dynamically change font size

I ran into an issue when developing my PhraseIt application against the new Windows 10 SDK. I wanted to utilize the whole screen to reduce the amount of white space. In the Windows 10 SDK, they utilize the DPI level to change the font size associated to the display size. This did not suite my needs because in the desktop view, the font would still be too small.

There was an article posted on StackOverflow about the issue. With the new SDK, there were a few tweaks needed.

The ListView is what I first wanted to get working. I first had to create an ItemTemplate with a binding TextBlock.

<ListView Name="CategoriesListView"  ItemsSource="{Binding}" IsSwipeEnabled="True" ScrollViewer.VerticalScrollBarVisibility="Hidden" SizeChanged="ListView_SizeChanged" Tapped="CategoriesListView_Tapped">  
                    <ListView.ItemTemplate>
                        <DataTemplate>
                            <TextBlock Text="{Binding CategoryName}" FontSize="{Binding Converter={StaticResource WidthScaleConverter}, ConverterParameter='ListView'}"/>
                        </DataTemplate>
                    </ListView.ItemTemplate>
                </ListView>

As we can see, there is a binding element on the FontSize. After this code has been inputted, we now need to add local resources.

<Grid.Resources>  
    <local:WidthScaleConverter x:Key="WidthScaleConverter">
    </local:WidthScaleConverter>
</Grid.Resources>  

After this, we need to create the class to handle the font sizes. This is not the best way and I will refactor this later, but it is a working solution as of now.

public class WidthScaleConverter : IValueConverter  
{
        public object Convert(object value, Type targetType, object parameter, string language)
        {
            int width = (int)Window.Current.Bounds.Width;
switch(parameter as string)  
            {
                case "ListView":
                    if (width > 1650)
                    {
                        return 100;
                    }
                    if (width > 1500)
                    {
                        return 90;
                    }
                    if (width > 1350)
                    {
                        return 80;
                    }
                    else if (width > 1165)
                    {
                        return 70;
                    }
                    if (width > 1000)
                    {
                        return 60;
                    }
                    if (width > 850)
                    {
                        return 50;
                    }
                    else if (width > 700)
                    {
                        return 40;
                    }
                    else if (width > 550)
                    {
                        return 30;
                    }
                    else
                    {
                        return 20;
                    }
                default: return 20;
            }
        }
        public object ConvertBack(object value, Type targetType, object parameter, string language)
        {
            throw new NotImplementedException();
        }
    }