Hi, I am trying to change the font for my entire app, using reflection. I have found this post on SO but it is in java and I have some problems converting it to C#:
final Field staticField = Typeface.class.getDeclaredField(staticTypefaceFieldName); staticField.setAccessible(true); staticField.set(null, newTypeface);
I have tried the following C# code:
var staticTypefaceFieldName = "Monospace"; Typeface newTypeFace = Typeface.CreateFromAsset(context.Assets, @"fonts/mycustomfont.ttf"); var font = typeof(Typeface).GetProperty(staticTypefaceFieldName); font.SetValue(null, newTypeface);
But this throws the following error:
Set Method not found for 'Monospace'
Does anybody know how to properly convert the above java code to C#?