Exemplo n.º 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));
 }
Exemplo n.º 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));
        }
 public SetDropdownIndexAction(IRef context, SelectorVM <SelectorItemVM> value)
 {
     DropdownContext       = context;
     SelectedIndexProperty = AccessTools.Property(DropdownContext.Value.GetType(), nameof(IDropdownProvider.SelectedIndex));
     Context  = new ProxyRef <object>(() => SelectedIndexProperty.GetValue(DropdownContext.Value), o => SelectedIndexProperty.SetValue(DropdownContext.Value, o));
     Value    = value.SelectedIndex;
     Original = Context.Value;
 }
Exemplo n.º 4
0
        public SettingsPropertyDefinitionWrapper(object @object) : base()
        {
            var type = @object.GetType();

            SettingsIdProperty       = AccessTools.Property(type, nameof(SettingsId));
            SettingTypeProperty      = AccessTools.Property(type, nameof(SettingType));
            PropertyProperty         = AccessTools.Property(type, nameof(PropertyReference));
            DisplayNameProperty      = AccessTools.Property(type, nameof(DisplayName));
            HintTextProperty         = AccessTools.Property(type, nameof(HintText));
            OrderProperty            = AccessTools.Property(type, nameof(Order));
            RequireRestartProperty   = AccessTools.Property(type, nameof(RequireRestart));
            GroupNameProperty        = AccessTools.Property(type, nameof(GroupName));
            IsMainToggleProperty     = AccessTools.Property(type, nameof(IsMainToggle));
            MinValueProperty         = AccessTools.Property(type, nameof(MinValue));
            MaxValueProperty         = AccessTools.Property(type, nameof(MaxValue));
            EditableMinValueProperty = AccessTools.Property(type, nameof(EditableMinValue));
            EditableMaxValueProperty = AccessTools.Property(type, nameof(EditableMaxValue));
            SelectedIndexProperty    = AccessTools.Property(type, nameof(SelectedIndex));


            SettingsId  = SettingsIdProperty?.GetValue(@object) as string ?? "ERROR";
            SettingType = SettingTypeProperty?.GetValue(@object) is { } settingTypeObject
                ? Enum.TryParse <SettingType>(settingTypeObject.ToString(), out var resultEnum)
                    ? resultEnum
                    : SettingType.NONE
                : SettingType.NONE;

            PropertyReference = PropertyProperty?.GetValue(@object) is { } value
                ? value is IRef @ref ? @ref : new RefWrapper(value)
                : null;

            DisplayName = DisplayNameProperty?.GetValue(@object) switch
            {
                string str => str,
                TextObject to => to.ToString(),
                       _ => DisplayName
            };
            HintText = HintTextProperty?.GetValue(@object) switch
            {
                string str => str,
                TextObject to => to.ToString(),
                       _ => HintText
            };
            Order          = OrderProperty?.GetValue(@object) as int? ?? -1;
            RequireRestart = RequireRestartProperty?.GetValue(@object) as bool? ?? true;

            GroupName    = GroupNameProperty?.GetValue(@object) as string ?? "";
            IsMainToggle = IsMainToggleProperty?.GetValue(@object) as bool? ?? false;

            MinValue         = MinValueProperty?.GetValue(@object) is { } minVal?minVal as decimal? ?? 0 : 0;
            MaxValue         = MaxValueProperty?.GetValue(@object) is { } maxVal?maxVal as decimal? ?? 0 : 0;
            EditableMinValue = EditableMinValueProperty?.GetValue(@object) is { } eMinVal?  eMinVal as decimal? ?? 0 : 0;
            EditableMaxValue = EditableMaxValueProperty?.GetValue(@object) is { } eMaxValue?eMaxValue as decimal? ?? 0 : 0;

            SelectedIndex = SelectedIndexProperty?.GetValue(@object) as int? ?? 0;
        }
    }
}
Exemplo n.º 5
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)));
 }
Exemplo n.º 6
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
            });
        }
Exemplo n.º 7
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));
        }
Exemplo n.º 8
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));
                }
            });
        }
Exemplo n.º 9
0
 set => SetCurrentValue(SelectedIndexProperty, value);
 static HorizontalFlipView()
 {
     DefaultStyleKeyProperty.OverrideMetadata(typeof(HorizontalFlipView), new FrameworkPropertyMetadata(typeof(HorizontalFlipView)));
     SelectedIndexProperty.OverrideMetadata(typeof(HorizontalFlipView), new FrameworkPropertyMetadata(-1, OnSelectedIndexChanged));
 }
Exemplo n.º 11
0
 static FormsCarouselPage()
 {
     DefaultStyleKeyProperty.OverrideMetadata(typeof(FormsCarouselPage), new FrameworkPropertyMetadata(typeof(FormsCarouselPage)));
     SelectedIndexProperty.OverrideMetadata(typeof(FormsCarouselPage), new FrameworkPropertyMetadata(-1, OnSelectedIndexChanged));
 }
 set => this.SetValue(SelectedIndexProperty, value);
Exemplo n.º 13
0
 //set index
 SetValue(SelectedIndexProperty, value);