Icons not showing in History Pane of RadFileDialog Window

1 Answer 40 Views
FileDialogs
ClausDC
Top achievements
Rank 1
Iron
Iron
ClausDC asked on 19 Jun 2024, 08:42 AM

Please see attached image. What could be the cause of this? Some Fonts missing?

I'm using StyleManager for Theming.

1 Answer, 1 is accepted

Sort by
0
Stenly
Telerik team
answered on 20 Jun 2024, 04:04 PM

Hello Claus,

This behavior can be present when there is a global Style for the TextBlock element, in which a setter for the FontFamily property is added that applies a new font.

To prevent this from occurring in the scope of the RadOpenFileDialog element while keeping the global FontFamily, you can use the following approach, which will retrieve these buttons and update the FontFamily property of the TextBlock elements inside them:

private void Button_Click(object sender, RoutedEventArgs e)
{
    RadOpenFileDialog radOpenFileDialog = new RadOpenFileDialog();

    radOpenFileDialog.Loaded += RadOpenFileDialog_Loaded;

    radOpenFileDialog.ShowDialog();
}

private void RadOpenFileDialog_Loaded(object sender, RoutedEventArgs e)
{
    RadOpenFileDialog radOpenFileDialog = (RadOpenFileDialog)sender;

    RadButton historyNavigationBackButton = radOpenFileDialog.ChildrenOfType<RadButton>().FirstOrDefault(x => x.Name == "HistoryNavigationBackButton");
    RadButton historyNavigationForwardButton = radOpenFileDialog.ChildrenOfType<RadButton>().FirstOrDefault(x => x.Name == "HistoryNavigationForwardButton");
    RadButton historyNavigationUpButton = radOpenFileDialog.ChildrenOfType<RadButton>().FirstOrDefault(x => x.Name == "HistoryNavigationUpButton");
    RadDropDownButton historyNavigationDropDownButton = radOpenFileDialog.ChildrenOfType<RadDropDownButton>().FirstOrDefault(x => x.Name == "PART_HistoryNavigationDropDownButton");

    this.SetFontFamilyOnTbOnButton(historyNavigationBackButton, historyNavigationBackButton.FontFamily);
    this.SetFontFamilyOnTbOnButton(historyNavigationForwardButton, historyNavigationForwardButton.FontFamily);
    this.SetFontFamilyOnTbOnButton(historyNavigationUpButton, historyNavigationUpButton.FontFamily);
    this.SetFontFamilyOnTbOnButton(historyNavigationDropDownButton, historyNavigationDropDownButton.FontFamily);
}

private void SetFontFamilyOnTbOnButton(RadButton button, FontFamily fontFamily)
{
    TextBlock tb = button.ChildrenOfType<TextBlock>().FirstOrDefault();

    if (tb != null)
    {
        tb.FontFamily = fontFamily;
    }
}

The approach uses the Loaded event of the RadOpenFileDialog instance and via the ChildrenOfType extension method, each of the buttons that are shown in the image that you provided are retrieved.

I hope the provided information will be of help to you.

Regards,
Stenly
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Tags
FileDialogs
Asked by
ClausDC
Top achievements
Rank 1
Iron
Iron
Answers by
Stenly
Telerik team
Share this question
or