Пример #1
0
 static FlipView()
 {
     DefaultStyleKeyProperty.OverrideMetadata(typeof(FlipView), new FrameworkPropertyMetadata(typeof(FlipView)));
     SelectedIndexProperty.OverrideMetadata(typeof(FlipView), new FrameworkPropertyMetadata(0, OnSelectedIndexChanged));
     HorizontalContentAlignmentProperty.OverrideMetadata(typeof(FlipView), new FrameworkPropertyMetadata(HorizontalAlignment.Stretch));
     VerticalContentAlignmentProperty.OverrideMetadata(typeof(FlipView), new FrameworkPropertyMetadata(VerticalAlignment.Stretch));
 }
Пример #2
0
        static TabControlStepper()
        {
            DefaultStyleKeyProperty.OverrideMetadata(typeof(TabControlStepper), new FrameworkPropertyMetadata(typeof(TabControlStepper)));

            object selectedIndexDefaultValue = SelectedIndexProperty.GetMetadata(typeof(TabControl)).DefaultValue;

            SelectedIndexProperty.OverrideMetadata(typeof(TabControlStepper), new FrameworkPropertyMetadata(selectedIndexDefaultValue, SelectedIndexChangedHandler));
        }
Пример #3
0
 /// <summary>
 /// Initialises static members of the <see cref="FlipControl"/> class.
 /// </summary>
 static FlipControl()
 {
     ItemsSourceProperty.OverrideMetadata(
         typeof(FlipControl),
         new FrameworkPropertyMetadata(new PropertyChangedCallback(OnItemsSourceChanged)));
     SelectedIndexProperty.OverrideMetadata(
         typeof(FlipControl),
         new FrameworkPropertyMetadata(new PropertyChangedCallback(OnSelectedIndexChanged)));
 }
Пример #4
0
        static SearchComboBox()
        {
            DefaultStyleKeyProperty.OverrideMetadata(typeof(SearchComboBox), new FrameworkPropertyMetadata(typeof(SearchComboBox)));

            SelectedIndexProperty.OverrideMetadata(typeof(SearchComboBox), new FrameworkPropertyMetadata {
                DefaultUpdateSourceTrigger = UpdateSourceTrigger.Explicit
            });
            SelectedItemProperty.OverrideMetadata(typeof(SearchComboBox), new FrameworkPropertyMetadata {
                DefaultUpdateSourceTrigger = UpdateSourceTrigger.Explicit
            });
            SelectedValueProperty.OverrideMetadata(typeof(SearchComboBox), new FrameworkPropertyMetadata {
                DefaultUpdateSourceTrigger = UpdateSourceTrigger.Explicit
            });
        }
Пример #5
0
        static FlipView()
        {
            DefaultStyleKeyProperty.OverrideMetadata(typeof(FlipView), new FrameworkPropertyMetadata(typeof(FlipView)));
            IsTabStopProperty.OverrideMetadata(typeof(FlipView), new FrameworkPropertyMetadata(false));
            var metadata = (FrameworkPropertyMetadata)SelectedIndexProperty.GetMetadata(typeof(Selector));

            SelectedIndexProperty.OverrideMetadata(
                typeof(FlipView),
                new FrameworkPropertyMetadata(
                    -1,
                    FrameworkPropertyMetadataOptions.BindsTwoWayByDefault | FrameworkPropertyMetadataOptions.Journal,
                    metadata.PropertyChangedCallback,
                    (d, baseValue) => CoerceSelectedIndex(d, metadata.CoerceValueCallback.Invoke(d, baseValue))));
            KeyboardNavigation.DirectionalNavigationProperty.OverrideMetadata(typeof(FlipView), new FrameworkPropertyMetadata(KeyboardNavigationMode.Contained));
            KeyboardNavigation.TabNavigationProperty.OverrideMetadata(typeof(FlipView), new FrameworkPropertyMetadata(KeyboardNavigationMode.Once));
            CommandManager.RegisterClassCommandBinding(typeof(FlipView), new CommandBinding(NavigationCommands.BrowseBack, OnPreviousExecuted, OnPreviousCanExecute));
            CommandManager.RegisterClassCommandBinding(typeof(FlipView), new CommandBinding(NavigationCommands.BrowseForward, OnNextExecuted, OnNextCanExecute));
            EventManager.RegisterClassHandler(typeof(FlipView), GesturePanel.GesturedEvent, new GesturedEventHandler(OnGestured));
        }
Пример #6
0
        static FlipView()
        {
            DefaultStyleKeyProperty.OverrideMetadata(typeof(FlipView), new FrameworkPropertyMetadata(typeof(FlipView)));

            /* Hook SelectedIndexProperty's coercion.
             * Coercion is called whenever the value of the DependencyProperty is being re-evaluated or coercion is specifically requested.
             * Coercion has access to current and proposed value to enforce compliance.
             * It is called after ValidateCallback.
             * So one can ultimately use this callback like a value is changing event.
             * As this control doesn't implement System.ComponentModel.INotifyPropertyChanging,
             * it's the only way to determine from/to index and ensure Transition consistency in any use case of the control.
             */
            var previousSelectedIndexPropertyMetadata = SelectedIndexProperty.GetMetadata(typeof(FlipView));

            SelectedIndexProperty.OverrideMetadata(typeof(FlipView),
                                                   new FrameworkPropertyMetadata
            {
                /* Coercion being behavior critical, we don't want to replace inherited or added callbacks.
                 * They must be called before ours and most of all : their result must be our input.
                 * But since delegates are multicast (meaning they can have more than on target), each target would sequentially be executed with the same original input
                 * thus not chaining invocations' inputs/outputs. So the caller would retrieve the sole last target's return value, ignoring previous computations.
                 * Hence, we chain coerions inputs/outputs until our callback to preserve the behavior of the control
                 * and be sure the value won't change anymore before being actually set.
                 */
                CoerceValueCallback = (d, value) =>
                {
                    /* Chain actual coercions... */
                    if (previousSelectedIndexPropertyMetadata.CoerceValueCallback != null)
                    {
                        foreach (var item in previousSelectedIndexPropertyMetadata.CoerceValueCallback.GetInvocationList())
                        {
                            value = ((CoerceValueCallback)item)(d, value);
                        }
                    }
                    /* ...'til our new one. */
                    return(CoerceSelectedIndexProperty(d, value));
                }
            });
        }
 static HorizontalFlipView()
 {
     DefaultStyleKeyProperty.OverrideMetadata(typeof(HorizontalFlipView), new FrameworkPropertyMetadata(typeof(HorizontalFlipView)));
     SelectedIndexProperty.OverrideMetadata(typeof(HorizontalFlipView), new FrameworkPropertyMetadata(-1, OnSelectedIndexChanged));
 }
Пример #8
0
 static FormsCarouselPage()
 {
     DefaultStyleKeyProperty.OverrideMetadata(typeof(FormsCarouselPage), new FrameworkPropertyMetadata(typeof(FormsCarouselPage)));
     SelectedIndexProperty.OverrideMetadata(typeof(FormsCarouselPage), new FrameworkPropertyMetadata(-1, OnSelectedIndexChanged));
 }