Skip to content

Commit

Permalink
Merge branch 'punker76-HamburgerMenu-Content-Binding-fix' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
punker76 committed Jan 27, 2017
2 parents 7fcc6b7 + ae0f648 commit a1d199d
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
Margin="20"
Foreground="White"
HamburgerWidth="48"
Content="{Binding RelativeSource={RelativeSource Self}, Mode=OneWay, Path=SelectedItem}"
ItemClick="HamburgerMenu_OnItemClick"
ItemTemplate="{StaticResource HamburgerMenuImageItem}"
OptionsItemClick="HamburgerMenu_OnOptionsItemClick"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,15 @@ public HamburgerMenuSample()

private void HamburgerMenu_OnItemClick(object sender, ItemClickEventArgs e)
{
HamburgerMenuControl.Content = e.ClickedItem;
// instead using binding Content="{Binding RelativeSource={RelativeSource Self}, Mode=OneWay, Path=SelectedItem}"
// we can do this
//HamburgerMenuControl.Content = e.ClickedItem;

// close the menu if a item was selected
if (this.HamburgerMenuControl.IsPaneOpen)
{
this.HamburgerMenuControl.IsPaneOpen = false;
}
}

private async void HamburgerMenu_OnOptionsItemClick(object sender, ItemClickEventArgs e)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public override void OnApplyTemplate()

private void HamburgerMenu_Loaded(object sender, RoutedEventArgs e)
{
this.Content = _buttonsListView?.SelectedItem ?? _optionsListView?.SelectedItem;
this.SetCurrentValue(ContentProperty, _buttonsListView?.SelectedItem ?? _optionsListView?.SelectedItem);
}
}
}

0 comments on commit a1d199d

Please sign in to comment.