Skip to content
Merged
Prev Previous commit
Next Next commit
Rename DP to DialogHost.IsRestoreFocusDisabled
  • Loading branch information
nicolaihenriksen committed Feb 28, 2023
commit adf82e2756c6730e5536553f7c020358c19423c3
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
</UserControl.Resources>

<Grid>
<materialDesign:DialogHost x:Name="DialogHost" IsFocusRestoreDisabled="True">
<materialDesign:DialogHost x:Name="DialogHost" IsRestoreFocusDisabled="True">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
Expand Down
14 changes: 7 additions & 7 deletions MaterialDesignThemes.Wpf/DialogHost.cs
Original file line number Diff line number Diff line change
Expand Up @@ -367,11 +367,11 @@ private static void IsOpenPropertyChangedCallback(DependencyObject dependencyObj

dialogHost.CurrentSession = new DialogSession(dialogHost);
var window = Window.GetWindow(dialogHost);
if (!dialogHost.IsFocusRestoreDisabled)
if (!dialogHost.IsRestoreFocusDisabled)
{
dialogHost._restoreFocusDialogClose = window != null ? FocusManager.GetFocusedElement(window) : null;

// Check restore focus overrides
// Check restore focus override
if (dialogHost._restoreFocusDialogClose is DependencyObject dependencyObj &&
GetRestoreFocusElement(dependencyObj) is { } focusOverride)
{
Expand Down Expand Up @@ -623,13 +623,13 @@ public static void SetRestoreFocusElement(DependencyObject element, IInputElemen
public static IInputElement GetRestoreFocusElement(DependencyObject element)
=> (IInputElement) element.GetValue(RestoreFocusElementProperty);

public static readonly DependencyProperty IsFocusRestoreDisabledProperty = DependencyProperty.Register(
nameof(IsFocusRestoreDisabled), typeof(bool), typeof(DialogHost), new PropertyMetadata(false));
public static readonly DependencyProperty IsRestoreFocusDisabledProperty = DependencyProperty.Register(
nameof(IsRestoreFocusDisabled), typeof(bool), typeof(DialogHost), new PropertyMetadata(false));

public bool IsFocusRestoreDisabled
public bool IsRestoreFocusDisabled
{
get => (bool) GetValue(IsFocusRestoreDisabledProperty);
set => SetValue(IsFocusRestoreDisabledProperty, value);
get => (bool) GetValue(IsRestoreFocusDisabledProperty);
set => SetValue(IsRestoreFocusDisabledProperty, value);
}

#endregion
Expand Down