/// <summary>
        /// Handles changes to the HideWhenSnapped property.
        /// </summary>
        /// <param name="d">
        /// The <see cref="DependencyObject"/> on which
        /// the property has changed value.
        /// </param>
        /// <param name="e">
        /// Event data that is issued by any event that
        /// tracks changes to the effective value of this property.
        /// </param>
        private static void OnHideWhenSnappedChanged(
            DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            bool oldHideWhenSnapped = (bool)e.OldValue;
            bool newHideWhenSnapped = (bool)d.GetValue(HideWhenSnappedProperty);

            if (newHideWhenSnapped)
            {
                var handler = new HideWhenSnappedHandler((AppBar)d);
                SetHideWhenSnappedHandler(d, handler);
            }
            else
            {
                var handler = GetHideWhenSnappedHandler(d);
                SetHideWhenSnappedHandler(d, null);
                handler.Detach();
            }
        }
        /// <summary>
        /// Handles changes to the HideWhenSnapped property.
        /// </summary>
        /// <param name="d">
        /// The <see cref="DependencyObject"/> on which
        /// the property has changed value.
        /// </param>
        /// <param name="e">
        /// Event data that is issued by any event that
        /// tracks changes to the effective value of this property.
        /// </param>
        private static void OnHideWhenSnappedChanged(
            DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            bool oldHideWhenSnapped = (bool)e.OldValue;
            bool newHideWhenSnapped = (bool)d.GetValue(HideWhenSnappedProperty);

            if (newHideWhenSnapped)
            {
                var handler = new HideWhenSnappedHandler((AppBar)d);
                SetHideWhenSnappedHandler(d, handler);
            }
            else
            {
                var handler = GetHideWhenSnappedHandler(d);
                SetHideWhenSnappedHandler(d, null);
                handler.Detach();
            }
        }
 public static void SetHideWhenSnappedHandler(DependencyObject d, HideWhenSnappedHandler value)
 {
     d.SetValue(HideWhenSnappedHandlerProperty, value);
 }
 public static void SetHideWhenSnappedHandler(DependencyObject d, HideWhenSnappedHandler value)
 {
     d.SetValue(HideWhenSnappedHandlerProperty, value);
 }