コード例 #1
0
        /// <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();
            }
        }
コード例 #2
0
        /// <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();
            }
        }
コード例 #3
0
 public static void SetHideWhenSnappedHandler(DependencyObject d, HideWhenSnappedHandler value)
 {
     d.SetValue(HideWhenSnappedHandlerProperty, value);
 }
コード例 #4
0
 public static void SetHideWhenSnappedHandler(DependencyObject d, HideWhenSnappedHandler value)
 {
     d.SetValue(HideWhenSnappedHandlerProperty, value);
 }