private void OnLoaded(object sender, RoutedEventArgs e)
{
var splitView = this.GetParentByType<SplitView>();
if (splitView == null)
{
throw new InvalidOperationException(
"SplitViewPaneMenu cannot be applied to a control that is not of type SplitView");
}
this._parent = splitView;
this._parent.RegisterPropertyChangedCallback(
SplitView.IsPaneOpenProperty,
(control, args) => { this.OnPaneToggled(); });
this.OnPaneToggled(); ;
}