Unplanned
Last Updated: 07 May 2025 09:02 by Stenly
Stenly
Created on: 07 May 2025 09:02
Category: Spreadsheet
Type: Bug Report
1
Spreadsheet: Custom Filter dialog's OK and Cancel buttons are different in size for the Windows 11 theme

The CustomFilterDialogContent element's OK and Cancel buttons are different in size for the Windows 11 theme.

To work this around, you can subscribe to the Loaded event of the CustomFilterDialogContent element and retrieve the RadButton with x:Name="PART_ButtonCancel" via the ChildrenOfType extension method. On the retrieved button, set the VerticalAlignment property to Center.

The following code snippet showcases this suggestion's implementation:

static MainWindow()
{
    EventManager.RegisterClassHandler(typeof(CustomFilterDialogContent), LoadedEvent, new RoutedEventHandler(OnCustomFilterDialogContentLoaded));
}

private static void OnCustomFilterDialogContentLoaded(object sender, RoutedEventArgs e)
{
    RadButton cancelButton = ((CustomFilterDialogContent)sender).ChildrenOfType<RadButton>().FirstOrDefault(x => x.Name == "PART_ButtonCancel");

    if (cancelButton != null)
    {
        cancelButton.VerticalAlignment = VerticalAlignment.Center;
    }
}

0 comments