Esempio n. 1
0
        public Button(View parent, View layoutParent = null, string id = null, Template template = null, Action <View> initializer = null) :
            base(parent, layoutParent, id, template ?? ButtonTemplates.Default, initializer)
        {
            // constructing Label (Label)
            Label = new Label(this, this, "Label", LabelTemplate);

            // binding <Label Offset="{TextOffset}">
            Bindings.Add(new Binding(new List <BindingPath> {
                new BindingPath(new List <string> {
                    "TextOffset"
                }, new List <Func <BindableObject> > {
                    () => this
                })
            }, new BindingPath(new List <string> {
                "Label", "Offset"
            }, new List <Func <BindableObject> > {
                () => this, () => Label
            }), () => Label.Offset = TextOffset, () => { }, false));
            Click.RegisterHandler(this, "ButtonMouseClick");
            MouseEnter.RegisterHandler(this, "ButtonMouseEnter");
            MouseExit.RegisterHandler(this, "ButtonMouseExit");
            MouseDown.RegisterHandler(this, "ButtonMouseDown");
            MouseUp.RegisterHandler(this, "ButtonMouseUp");
            this.AfterInitializeInternal();
        }
Esempio n. 2
0
 public ListItem(View parent, View layoutParent = null, string id = null, Template template = null, Action <View> initializer = null) :
     base(parent, layoutParent, id, template ?? ListItemTemplates.Default, initializer)
 {
     Click.RegisterHandler(this, "ListItemMouseClick");
     MouseEnter.RegisterHandler(this, "ListItemMouseEnter");
     MouseExit.RegisterHandler(this, "ListItemMouseExit");
     MouseDown.RegisterHandler(this, "ListItemMouseDown");
     MouseUp.RegisterHandler(this, "ListItemMouseUp");
     this.AfterInitializeInternal();
 }
Esempio n. 3
0
        public Button(View parent, View layoutParent = null, string id = null, Template template = null, bool deferInitialization = false) :
            base(parent, layoutParent, id, template ?? ButtonTemplates.Default, deferInitialization)
        {
            if (deferInitialization)
            {
                return;
            }

            // constructing Label (Label)
            Label = new Label(this, this, "Label", LabelTemplate);

            // binding <Label Offset="{TextOffset}">
            Bindings.Add(new Binding(new List <BindingPath> {
                new BindingPath(new List <string> {
                    "TextOffset"
                }, new List <Func <object> > {
                    () => this
                })
            }, new BindingPath(new List <string> {
                "Label", "Offset"
            }, new List <Func <object> > {
                () => this, () => Label
            }), () => Label.Offset = TextOffset, () => { }, false));

            // binding <Label IsActive="{DisplayLabel}">
            Bindings.Add(new Binding(new List <BindingPath> {
                new BindingPath(new List <string> {
                    "DisplayLabel"
                }, new List <Func <object> > {
                    () => this
                })
            }, new BindingPath(new List <string> {
                "Label", "IsActive"
            }, new List <Func <object> > {
                () => this, () => Label
            }), () => Label.IsActive = DisplayLabel, () => { }, false));
            this.StateAnimations.Clear();
            var stateAnimation0 = new StateAnimation(AnyStateName, "Highlighted");

            stateAnimation0.Add(new Animator <UnityEngine.Color>(this, 0.05f, 0f, false, false, 0f, false, EasingFunctions.Get("Linear"), Delight.ColorValueConverter.Interpolator, x => this.BackgroundColor = x, () => this.BackgroundColor, () => Button.BackgroundColorProperty.NotifyPropertyChanged(this), Button.BackgroundColorProperty, AnyStateName, "Highlighted"));
            stateAnimation0.Add(new Animator <UnityEngine.Color>(this, 0.05f, 0f, false, false, 0f, false, EasingFunctions.Get("Linear"), Delight.ColorValueConverter.Interpolator, x => this.FontColor       = x, () => this.FontColor, () => Button.FontColorProperty.NotifyPropertyChanged(this), Button.FontColorProperty, AnyStateName, "Highlighted"));
            this.StateAnimations.Add(stateAnimation0);
            var stateAnimation1 = new StateAnimation("Highlighted", DefaultStateName);

            stateAnimation1.Add(new Animator <UnityEngine.Color>(this, 0.5f, 0f, false, false, 0f, false, EasingFunctions.Get("Linear"), Delight.ColorValueConverter.Interpolator, x => this.BackgroundColor = x, () => this.BackgroundColor, () => Button.BackgroundColorProperty.NotifyPropertyChanged(this), Button.BackgroundColorProperty, "Highlighted", DefaultStateName));
            stateAnimation1.Add(new Animator <UnityEngine.Color>(this, 0.5f, 0f, false, false, 0f, false, EasingFunctions.Get("Linear"), Delight.ColorValueConverter.Interpolator, x => this.FontColor       = x, () => this.FontColor, () => Button.FontColorProperty.NotifyPropertyChanged(this), Button.FontColorProperty, "Highlighted", DefaultStateName));
            this.StateAnimations.Add(stateAnimation1);
            Click.RegisterHandler(this, "ButtonMouseClick");
            MouseEnter.RegisterHandler(this, "ButtonMouseEnter");
            MouseExit.RegisterHandler(this, "ButtonMouseExit");
            MouseDown.RegisterHandler(this, "ButtonMouseDown");
            MouseUp.RegisterHandler(this, "ButtonMouseUp");
            this.AfterInitializeInternal();
        }
Esempio n. 4
0
 public GridSplitterHandle(View parent, View layoutParent = null, string id = null, Template template = null, Action <View> initializer = null) :
     base(parent, layoutParent, id, template ?? GridSplitterHandleTemplates.Default, initializer)
 {
     // constructing Image (SplitterHandle)
     SplitterHandle = new Image(this, this, "SplitterHandle", SplitterHandleTemplate);
     Drag.RegisterHandler(this, "OnDrag");
     BeginDrag.RegisterHandler(this, "OnBeginDrag");
     InitializePotentialDrag.RegisterHandler(this, "OnInitializePotentialDrag");
     EndDrag.RegisterHandler(this, "OnEndDrag");
     MouseEnter.RegisterHandler(this, "OnMouseEnter");
     MouseExit.RegisterHandler(this, "OnMouseExit");
     ContentContainer = SplitterHandle;
     this.AfterInitializeInternal();
 }
Esempio n. 5
0
        public ListItem(View parent, View layoutParent = null, string id = null, Template template = null, bool deferInitialization = false) :
            base(parent, layoutParent, id, template ?? ListItemTemplates.Default, deferInitialization)
        {
            if (deferInitialization)
            {
                return;
            }

            Click.RegisterHandler(this, "ListItemMouseClick");
            MouseEnter.RegisterHandler(this, "ListItemMouseEnter");
            MouseExit.RegisterHandler(this, "ListItemMouseExit");
            MouseDown.RegisterHandler(this, "ListItemMouseDown");
            MouseUp.RegisterHandler(this, "ListItemMouseUp");
            SetListItemState = new AttachedProperty <System.Boolean>(this, "SetListItemState");
            this.AfterInitializeInternal();
        }