Skip to content

Commit

Permalink
Fix exception when reparenting repeater
Browse files Browse the repository at this point in the history
  • Loading branch information
Kinnara committed Apr 26, 2020
1 parent 974a6e3 commit 3cc4b70
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 4 additions & 0 deletions ModernWpf.Controls/Common/Extensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,19 @@ public static FlyoutBase Flyout(this Button button)
return FlyoutService.GetFlyout(button);
}

/*
public static void RemoveAtEnd(this IList list)
{
list.RemoveAt(list.Count - 1);
}
*/

/*
public static void RemoveAtEnd<T>(this IList<T> list)
{
list.RemoveAt(list.Count - 1);
}
*/

public static void UseSystemFocusVisuals(this Control control, bool value)
{
Expand Down
4 changes: 2 additions & 2 deletions ModernWpf.Controls/NavigationView/NavigationViewItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -585,15 +585,15 @@ void ReparentRepeater()
{
// Reparent repeater to flyout
// TODO: Replace removeatend with something more specific
m_rootGrid.Children.RemoveAtEnd();
m_rootGrid.Children.Remove(repeater);
m_flyoutContentGrid.Children.Add(repeater);
m_isRepeaterParentedToFlyout = true;

PropagateDepthToChildren(0);
}
else if (!ShouldRepeaterShowInFlyout() && m_isRepeaterParentedToFlyout)
{
m_flyoutContentGrid.Children.RemoveAtEnd();
m_flyoutContentGrid.Children.Remove(repeater);
m_rootGrid.Children.Add(repeater);
m_isRepeaterParentedToFlyout = false;

Expand Down

0 comments on commit 3cc4b70

Please sign in to comment.