hi i want change fontfamily from codebehind but my font is a resource style
how can i do this?
this is my fontDictionary
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<FontFamily x:Key="IRANSans">IRANSans, pack://application:,,,/PersianCalendar;component/Resources/Fonts/Fonts/#IRANSans</FontFamily>
</ResourceDictionary>
in xaml i can set font this way:
FontFamily="{StaticResources IranSans}"
but i dont know how i can do this in codebehind, i want something like this
pt.FontFamily = new FontFamily(TryFindResources("IranSans"));