Exemple #1
0
 /// <summary>
 /// Initializes static members of the <see cref="Slider"/> class.
 /// </summary>
 static Slider()
 {
     OrientationProperty.OverrideDefaultValue(typeof(Slider), Orientation.Horizontal);
     Thumb.DragStartedEvent.AddClassHandler <Slider>((x, e) => x.OnThumbDragStarted(e), RoutingStrategies.Bubble);
     Thumb.DragDeltaEvent.AddClassHandler <Slider>((x, e) => x.OnThumbDragDelta(e), RoutingStrategies.Bubble);
     Thumb.DragCompletedEvent.AddClassHandler <Slider>((x, e) => x.OnThumbDragCompleted(e), RoutingStrategies.Bubble);
 }
Exemple #2
0
 /// <summary>
 /// Initializes static members of the <see cref="ContextMenu"/> class.
 /// </summary>
 static ContextMenu()
 {
     ItemsPanelProperty.OverrideDefaultValue <ContextMenu>(DefaultPanel);
     PlacementModeProperty.OverrideDefaultValue <ContextMenu>(PlacementMode.Pointer);
     ContextMenuProperty.Changed.Subscribe(ContextMenuChanged);
     AutomationProperties.AccessibilityViewProperty.OverrideDefaultValue <ContextMenu>(AccessibilityView.Control);
     AutomationProperties.ControlTypeOverrideProperty.OverrideDefaultValue <ContextMenu>(AutomationControlType.Menu);
 }
Exemple #3
0
 /// <summary>
 /// Initializes static members of the <see cref="Slider"/> class.
 /// </summary>
 static SliderEx()
 {
     PressedMixin.Attach <Slider>();
     OrientationProperty.OverrideDefaultValue(typeof(Slider), Orientation.Horizontal);
     Thumb.DragStartedEvent.AddClassHandler <SliderEx>((x, e) => x.OnThumbDragStarted(e), RoutingStrategies.Bubble);
     Thumb.DragCompletedEvent.AddClassHandler <SliderEx>((x, e) => x.OnThumbDragCompleted(e),
                                                         RoutingStrategies.Bubble);
 }
Exemple #4
0
 /// <summary>
 /// Initializes static members of the <see cref="Slider"/> class.
 /// </summary>
 static Slider()
 {
     OrientationProperty.OverrideDefaultValue(typeof(Slider), Orientation.Horizontal);
     PseudoClass <Slider, Orientation>(OrientationProperty, o => o == Orientation.Vertical, ":vertical");
     PseudoClass <Slider, Orientation>(OrientationProperty, o => o == Orientation.Horizontal, ":horizontal");
     Thumb.DragStartedEvent.AddClassHandler <Slider>(x => x.OnThumbDragStarted, RoutingStrategies.Bubble);
     Thumb.DragDeltaEvent.AddClassHandler <Slider>(x => x.OnThumbDragDelta, RoutingStrategies.Bubble);
     Thumb.DragCompletedEvent.AddClassHandler <Slider>(x => x.OnThumbDragCompleted, RoutingStrategies.Bubble);
 }
Exemple #5
0
 /// <summary>
 /// Initializes static members of the <see cref="Slider"/> class.
 /// </summary>
 static Slider()
 {
     OrientationProperty.OverrideDefaultValue(typeof(Slider), Orientation.Horizontal);
     Thumb.DragStartedEvent.AddClassHandler <Slider>(x => x.OnThumbDragStarted, RoutingStrategies.Bubble);
     Thumb.DragDeltaEvent.AddClassHandler <Slider>(x => x.OnThumbDragDelta, RoutingStrategies.Bubble);
     Thumb.DragCompletedEvent.AddClassHandler <Slider>(x => x.OnThumbDragCompleted, RoutingStrategies.Bubble);
     SmallChangeProperty.OverrideDefaultValue <Slider>(1);
     LargeChangeProperty.OverrideDefaultValue <Slider>(10);
 }
Exemple #6
0
        /// <summary>
        /// Initializes static members of the <see cref="Slider"/> class.
        /// </summary>
        static SliderEx()
        {
            PressedMixin.Attach <SliderEx>();
            OrientationProperty.OverrideDefaultValue(typeof(SliderEx), Orientation.Horizontal);
            Thumb.DragStartedEvent.AddClassHandler <SliderEx>((x, e) => x.OnThumbDragStarted(e), RoutingStrategies.Bubble);
            Thumb.DragCompletedEvent.AddClassHandler <SliderEx>((x, e) => x.OnThumbDragCompleted(e),
                                                                RoutingStrategies.Bubble);

            ValueProperty.OverrideMetadata <SliderEx>(new DirectPropertyMetadata <double>(enableDataValidation: true));
        }
Exemple #7
0
 static Ribbon()
 {
     OrientationProperty = StackLayout.OrientationProperty.AddOwner <Ribbon>();
     OrientationProperty.OverrideDefaultValue <Ribbon>(Orientation.Horizontal);
     HeaderBackgroundProperty = AvaloniaProperty.Register <Ribbon, IBrush>(nameof(HeaderBackground));
     HeaderForegroundProperty = AvaloniaProperty.Register <Ribbon, IBrush>(nameof(HeaderForeground));
     IsCollapsedProperty      = AvaloniaProperty.Register <Ribbon, bool>(nameof(IsCollapsed));
     IsMenuOpenProperty       = AvaloniaProperty.Register <Ribbon, bool>(nameof(IsMenuOpen));
     MenuItemsProperty        = MenuBase.ItemsProperty.AddOwner <Ribbon>(x => x.MenuItems, (x, v) => x.MenuItems = v);
     MenuPlacesItemsProperty  = ItemsControl.ItemsProperty.AddOwner <Ribbon>(x => x.MenuPlacesItems, (x, v) => x.MenuPlacesItems = v);
 }
Exemple #8
0
        static Ribbon()
        {
            OrientationProperty = StackLayout.OrientationProperty.AddOwner <Ribbon>();
            OrientationProperty.OverrideDefaultValue <Ribbon>(Orientation.Horizontal);
            HeaderBackgroundProperty     = AvaloniaProperty.Register <Ribbon, IBrush>(nameof(HeaderBackground));
            HeaderForegroundProperty     = AvaloniaProperty.Register <Ribbon, IBrush>(nameof(HeaderForeground));
            IsCollapsedProperty          = AvaloniaProperty.Register <Ribbon, bool>(nameof(IsCollapsed));
            IsCollapsedPopupOpenProperty = AvaloniaProperty.Register <Ribbon, bool>(nameof(IsCollapsedPopupOpen));
            IsMenuOpenProperty           = AvaloniaProperty.Register <Ribbon, bool>(nameof(IsMenuOpen));

            SelectedIndexProperty.Changed.AddClassHandler <Ribbon>((x, e) =>
            {
                if (((int)e.NewValue >= 0) && (x.SelectedItem != null) && (x.SelectedItem is RibbonTab tab))
                {
                    x.SelectedGroups = tab.Groups;
                }
                else
                {
                    x.SelectedGroups = new AvaloniaList <object>();
                }
            });

            IsCollapsedProperty.Changed.AddClassHandler(new Action <Ribbon, AvaloniaPropertyChangedEventArgs>((sneder, args) =>
            {
                sneder.UpdatePresenterLocation((bool)args.NewValue);
            }));

            AccessKeyHandler.AccessKeyPressedEvent.AddClassHandler <Ribbon>((sender, e) =>
            {
                if (e.Source is Control ctrl)
                {
                    (sender as Ribbon).HandleKeyTipControl(ctrl);
                }
            });

            KeyTip.ShowChildKeyTipKeysProperty.Changed.AddClassHandler <Ribbon>(new Action <Ribbon, AvaloniaPropertyChangedEventArgs>((sender, args) =>
            {
                bool isOpen = (bool)args.NewValue;
                if (isOpen)
                {
                    sender.Focus();
                }
                sender.SetChildKeyTipsVisibility(isOpen);
            }));

            HelpButtonCommandProperty = AvaloniaProperty.RegisterDirect <Ribbon, ICommand>(nameof(HelpButtonCommand), o => o.HelpButtonCommand, (o, v) => o.HelpButtonCommand = v);

            BoundsProperty.Changed.AddClassHandler <RibbonGroupsStackPanel>((sender, e) => sender.InvalidateMeasure());
        }
Exemple #9
0
 /// <summary>
 /// Initializes static members of the <see cref="ItemsControl"/> class.
 /// </summary>
 static ListBox()
 {
     ItemsPanelProperty.OverrideDefaultValue <ListBox>(DefaultPanel);
     VirtualizationModeProperty.OverrideDefaultValue <ListBox>(ItemVirtualizationMode.Simple);
 }
Exemple #10
0
 static ContextMenu()
 {
     ItemsPanelProperty.OverrideDefaultValue <ContextMenu>(DefaultPanel);
     PlacementModeProperty.OverrideDefaultValue <ContextMenu>(PlacementMode.Pointer);
     ContextMenuProperty.Changed.Subscribe(ContextMenuChanged);
 }
 static UniformGridLayout()
 {
     OrientationProperty.OverrideDefaultValue <UniformGridLayout>(Orientation.Horizontal);
 }
Exemple #12
0
 static Class3()
 {
     StyledProperty.OverrideDefaultValue <Class3>("baz");
 }
Exemple #13
0
 static Class2()
 {
     StyledProperty.OverrideDefaultValue <Class2>("bar");
     DirectProperty.OverrideMetadata <Class2>(new DirectPropertyMetadata <string>("bar"));
 }