BidirectionalDial tempGauge = new Dial360();
if (chp.DialType.Equals("360"))
{
tempGauge = new Dial360();
}
else if (chp.DialType.Equals("180"))
{
tempGauge = new Dial180North();
}
else if (chp.DialType.Equals("90"))
{
tempGauge = new Dial90SouthEast();
}
tempGauge.FontSize = GaugeDialProperty.getGaugeFontSize(chp.DialType, chp.MaxVal);
GetGaugeFontSize
returns an integer but it is only applied to Dial360
. It is not applyed to Dial180North
and Dial90SouthEast
and they use default font size. How can I solve this issue?
Solution:
Grid dg = (Grid)tempGauge.Content;
foreach (UIElement ui in dg.Children)
{
Type elementType = ui.GetType();
if (elementType.FullName == "System.Windows.Controls.TextBlock")
{
TextBlock tb = (TextBlock)ui;
tb.FontSize = fontSize;
}
}