Sometimes we need to give options to users to select a font family to use with their own methods for implementation.
Let’s see the steps.
Create a new Windows 10 universal application and go to your MainPage.xaml.
Now add one listview control to list the font family and also add one control inside the ListView, for font name like the following xaml code. Add one textblock control to see the changes.
- <TextBlock x:Name="sampleTextBloxk" Text="Suresh M C# Corner MVP">
- </TextBlock>
- <ListView x:Name="FontListBox" SelectionChanged="FontListBox_SelectionChanged">
- <ListView.ItemTemplate>
- <DataTemplate>
- <TextBlock Text="{Binding fName}"></TextBlock>
- </DataTemplate>
- </ListView.ItemTemplate>
- </ListView>

- public void getFontList()
- {
- List < fonts > fList = newList < fonts > ();
- string[] fontList = Microsoft.Graphics.Canvas.Text.CanvasTextFormat.GetSystemFontFamilies();
- foreach(var font in fontList)
- {
- fList.Add(newfonts()
- {
- fName = string.Format("Font: {0}", font)
- });
- }
- FontListBox.ItemsSource = fList;
- }
- private void FontListBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
- {
- var selectedFont= e.AddedItems[0].ToString();
- sampleTextBloxk.FontFamily = newFontFamily(selectedFont);
- }
- Windows.Storage.ApplicationDataContainer localSettings = Windows.Storage.ApplicationData.Current.LocalSettings;
- localSettings.Values["Myfonts"] = selectedFont;
- object value = localSettings.Values["Myfonts"];

For more information on Windows 10 UWP, refer to my e-book:

Sonu ChaudharyPosted Jun 6, 2016, 10:00 AM
good one...
Debasis SahaPosted Jun 6, 2016, 12:25 AM
Good One..
Vignesh ManiPosted Jun 2, 2016, 5:58 AM
Nice
Ketak BhalsingPosted Jun 2, 2016, 12:44 AM
Helpful information....
Thiruppathi RPosted Jun 1, 2016, 10:22 PM
Nice...
Debasis SahaPosted Jun 1, 2016, 2:09 PM
Nice one..