Skip to content

Commit

Permalink
chore: Run Bindings.Update on DataContextChanged
Browse files Browse the repository at this point in the history
(cherry picked from commit 930cfbc)
  • Loading branch information
MartinZikmund authored and mergify[bot] committed Aug 11, 2023
1 parent 41bc4d7 commit 02e0363
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,27 @@

using Windows.UI.Xaml.Controls;

namespace FrameworkPoolEditorRecycling.Editors
namespace FrameworkPoolEditorRecycling.Editors;

/// <summary>
/// An empty page that can be used on its own or navigated to within a Frame.
/// </summary>
public sealed partial class EditorXBindPropertyChangedView : Page
{
/// <summary>
/// An empty page that can be used on its own or navigated to within a Frame.
/// </summary>
public sealed partial class EditorXBindPropertyChangedView : Page
{
public EditorViewModel ViewModel { get; private set; }
public EditorViewModel ViewModel { get; private set; }

public EditorXBindPropertyChangedView()
{
this.InitializeComponent();
this.DataContextChanged += Editor2View_DataContextChanged;
}
public EditorXBindPropertyChangedView()
{
this.InitializeComponent();
this.DataContextChanged += Editor2View_DataContextChanged;
}

private void Editor2View_DataContextChanged(Windows.UI.Xaml.FrameworkElement sender, Windows.UI.Xaml.DataContextChangedEventArgs args)
private void Editor2View_DataContextChanged(Windows.UI.Xaml.FrameworkElement sender, Windows.UI.Xaml.DataContextChangedEventArgs args)
{
if (DataContext is EditorViewModel editor)
{
if (DataContext is EditorViewModel editor)
{
ViewModel = editor;
}
ViewModel = editor;
Bindings.Update();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ private void EditorXBindView_DataContextChanged(Windows.UI.Xaml.FrameworkElement
if (DataContext is EditorViewModel editor)
{
ViewModel = editor;
Bindings.Update();
}
}
}

0 comments on commit 02e0363

Please sign in to comment.