示例#1
0
        /// <summary>
        /// Fired when the SelectedItem changes.
        /// </summary>
        /// <param name="d">The sender</param>
        /// <param name="e">The event args</param>
        /// <remarks>
        /// Sets up animations for the DetailsPresenter for animating in/out.
        /// </remarks>
        private static void OnSelectedItemChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            MasterDetailsView view = (MasterDetailsView)d;

            // Prevent setting the SelectedItem to null if only the order changed (=> collection reset got triggered).
            if (!view.ignoreClearSelectedItem && !(e.OldValue is null) && e.NewValue is null && view.Items.Contains(e.OldValue))
            {
                view.SelectedItem = e.OldValue;
                return;
            }

            view.OnSelectionChanged(new SelectionChangedEventArgs(new List <object> {
                e.OldValue
            }, new List <object> {
                e.NewValue
            }));

            view.UpdateView(true);

            // If there is no selection, do not remove the DetailsPresenter content but let it animate out.
            if (view.SelectedItem != null)
            {
                view.SetDetailsContent();
            }
        }
示例#2
0
        /// <summary>
        /// Fired when the MasterCommandBar changes.
        /// </summary>
        /// <param name="d">The sender</param>
        /// <param name="e">The event args</param>
        private static void OnMasterCommandBarChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            MasterDetailsView view = (MasterDetailsView)d;

            view.OnMasterCommandBarChanged();
        }
示例#3
0
        private static void OnBackButtonBehaviorChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            MasterDetailsView view = (MasterDetailsView)d;

            view.SetBackButtonVisibility();
        }
示例#4
0
        /// <summary>
        /// Fired when the <see cref="MasterHeader"/> is changed.
        /// </summary>
        /// <param name="d">The sender</param>
        /// <param name="e">The event args</param>
        private static void OnMasterHeaderChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            MasterDetailsView view = (MasterDetailsView)d;

            view.SetMasterHeaderVisibility();
        }