Esempio n. 1
0
        public CanvasRendererView(View parent, View layoutParent = null, string id = null, Template template = null, bool deferInitialization = false) :
            base(parent, layoutParent, id, template ?? CanvasRendererViewTemplates.Default, deferInitialization)
        {
            if (deferInitialization)
            {
                return;
            }

            this.AfterInitializeInternal();
        }
Esempio n. 2
0
        public PerformanceTest(View parent, View layoutParent = null, string id = null, Template template = null, bool deferInitialization = false) :
            base(parent, layoutParent, id, template ?? PerformanceTestTemplates.Default, deferInitialization)
        {
            if (deferInitialization)
            {
                return;
            }

            this.AfterInitializeInternal();
        }
Esempio n. 3
0
        public GroupExamples(View parent, View layoutParent = null, string id = null, Template template = null, Action <View> initializer = null) :
            base(parent, layoutParent, id, template ?? GroupExamplesTemplates.Default, initializer)
        {
            // constructing List (PlayerList)
            PlayerList = new List(this, this, "PlayerList", PlayerListTemplate);

            // binding <List Items="{player in @Players}">
            Bindings.Add(new Binding(new List <BindingPath> {
                new BindingPath(new List <string> {
                }, new List <Func <BindableObject> > {
                })
            }, new BindingPath(new List <string> {
                "PlayerList", "Items"
            }, new List <Func <BindableObject> > {
                () => this, () => PlayerList
            }), () => PlayerList.Items = Models.Players, () => { }, false));

            // templates for PlayerList
            PlayerList.ContentTemplates.Add(new ContentTemplate(tiPlayer =>
            {
                var listItem1  = new ListItem(this, PlayerList.Content, "ListItem1", ListItem1Template);
                var buttonTest = new Button(this, listItem1.Content, "ButtonTest", ButtonTestTemplate);

                // binding <Button Text="{player.Name}">
                listItem1.Bindings.Add(new Binding(new List <BindingPath> {
                    new BindingPath(new List <string> {
                        "Item", "Name"
                    }, new List <Func <BindableObject> > {
                        () => tiPlayer, () => (tiPlayer.Item as Delight.Player)
                    })
                }, new BindingPath(new List <string> {
                    "Text"
                }, new List <Func <BindableObject> > {
                    () => buttonTest
                }), () => buttonTest.Text = (tiPlayer.Item as Delight.Player).Name, () => { }, false));
                listItem1.IsDynamic       = true;
                listItem1.SetContentTemplateData(tiPlayer);
                return(listItem1);
            }, typeof(ListItem), "ListItem1"));
            this.AfterInitializeInternal();
        }
Esempio n. 4
0
        /// <summary>
        /// Returns boolean indicating if dependency property has state value set.
        /// </summary>
        public override bool HasState(Template key, string state)
        {
            T defaultValue;

            return(TryGetStateDefault(key, state, out defaultValue));
        }
Esempio n. 5
0
        public SliderExample(View parent, View layoutParent = null, string id = null, Template template = null, bool deferInitialization = false) :
            base(parent, layoutParent, id, template ?? SliderExampleTemplates.Default, deferInitialization)
        {
            if (deferInitialization)
            {
                return;
            }

            // constructing Group (Group1)
            Group1  = new Group(this, this, "Group1", Group1Template);
            Group2  = new Group(this, Group1.Content, "Group2", Group2Template);
            Slider1 = new Slider(this, Group2.Content, "Slider1", Slider1Template);
            Label1  = new Label(this, Group2.Content, "Label1", Label1Template);

            // binding <Label Text="{Slider1.Value:0} %">
            Bindings.Add(new Binding(new List <BindingPath> {
                new BindingPath(new List <string> {
                    "Slider1", "Value"
                }, new List <Func <object> > {
                    () => this, () => Slider1
                })
            }, new BindingPath(new List <string> {
                "Label1", "Text"
            }, new List <Func <object> > {
                () => this, () => Label1
            }), () => Label1.Text = String.Format("{0:0} %", Slider1.Value), () => { }, false));
            Group3  = new Group(this, Group1.Content, "Group3", Group3Template);
            Slider2 = new Slider(this, Group3.Content, "Slider2", Slider2Template);
            Label2  = new Label(this, Group3.Content, "Label2", Label2Template);

            // binding <Label Text="{Slider2.Value:0.0}">
            Bindings.Add(new Binding(new List <BindingPath> {
                new BindingPath(new List <string> {
                    "Slider2", "Value"
                }, new List <Func <object> > {
                    () => this, () => Slider2
                })
            }, new BindingPath(new List <string> {
                "Label2", "Text"
            }, new List <Func <object> > {
                () => this, () => Label2
            }), () => Label2.Text = String.Format("{0:0.0}", Slider2.Value), () => { }, false));
            this.AfterInitializeInternal();
        }
Esempio n. 6
0
 /// <summary>
 /// Sets default state value for type.
 /// </summary>
 public override void SetStateDefaultGeneric(string state, Template template, object defaultValue)
 {
     SetStateDefault(state, template, (T)defaultValue);
 }
Esempio n. 7
0
 /// <summary>
 /// Sets default value for type.
 /// </summary>
 public override void SetDefaultGeneric(Template template, object defaultValue)
 {
     SetDefault(template, (T)defaultValue);
 }
Esempio n. 8
0
 /// <summary>
 /// Sets default value for type.
 /// </summary>
 public virtual void SetDefault(Template template, T defaultValue)
 {
     Defaults[template] = defaultValue;
 }
Esempio n. 9
0
        public DefaultExpanderHeader(View parent, View layoutParent = null, string id = null, Template template = null, bool deferInitialization = false) :
            base(parent, layoutParent, id, template ?? DefaultExpanderHeaderTemplates.Default, deferInitialization)
        {
            if (deferInitialization)
            {
                return;
            }

            // constructing Group (HeaderGroup)
            HeaderGroup = new Group(this, this, "HeaderGroup", HeaderGroupTemplate);
            HeaderIcon  = new Image(this, HeaderGroup.Content, "HeaderIcon", HeaderIconTemplate);

            // binding <Image Sprite="{Sprite}">
            Bindings.Add(new Binding(new List <BindingPath> {
                new BindingPath(new List <string> {
                    "Sprite"
                }, new List <Func <object> > {
                    () => this
                })
            }, new BindingPath(new List <string> {
                "HeaderIcon", "Sprite"
            }, new List <Func <object> > {
                () => this, () => HeaderIcon
            }), () => HeaderIcon.Sprite = Sprite, () => { }, false));
            HeaderLabel = new Label(this, HeaderGroup.Content, "HeaderLabel", HeaderLabelTemplate);

            // binding <Label Text="{Text}">
            Bindings.Add(new Binding(new List <BindingPath> {
                new BindingPath(new List <string> {
                    "Text"
                }, new List <Func <object> > {
                    () => this
                })
            }, new BindingPath(new List <string> {
                "HeaderLabel", "Text"
            }, new List <Func <object> > {
                () => this, () => HeaderLabel
            }), () => HeaderLabel.Text = Text, () => { }, false));
            this.AfterInitializeInternal();
        }
Esempio n. 10
0
 public UICanvas(View parent, View layoutParent = null, string id = null, Template template = null, Action<View> initializer = null) :
     base(parent, layoutParent, id, template ?? UICanvasTemplates.Default, initializer)
 {
     this.AfterInitializeInternal();
 }