internal IconTitleDescriptionChevron(Bindable <string> iconBinding, Bindable <string> titleBinding, Bindable <string> descriptionBinding, Bindable <string> chevronBinding)
 {
     Title.Bind("Text", () => titleBinding);
     Description.Bind("Text", () => descriptionBinding);
     Chevron.Bind("Text", () => chevronBinding);
     Icon.Bind("Path", () => iconBinding);
 }
Пример #2
0
 internal IndexTitleDescriptionChevron(Bindable <string> indexBinding, Bindable <string> titleBinding, Bindable <string> descriptionBinding, Bindable <string> chevronBinding)
 {
     Title.Bind("Text", () => titleBinding);
     Description.Bind("Text", () => descriptionBinding);
     Index.Bind("Text", () => indexBinding);
     Chevron.Bind("Text", () => chevronBinding);
 }
Пример #3
0
        private static void Main()
        {
            var gridWindowTest = new GridWindow
            {
                Title          = "GridWindow Test (Next: Shift+Tab)",
                DrawBorders    = true,
                RowDefinitions =
                {
                    new GridSize(GridUnitType.Fixed, 10),
                    new GridSize(GridUnitType.Auto,   0),
                    new GridSize(GridUnitType.Auto,   0),
                },
                ColumnDefinitions =
                {
                    new GridSize(GridUnitType.Grow,  3),
                    new GridSize(GridUnitType.Grow,  2),
                    new GridSize(GridUnitType.Fixed, 15)
                },
                Children =
                {
                    new Border
                    {
                        FrameStyle = FrameStyle.Single,
                        Content    = new TextView
                        {
                            Text = "1"
                        },
                        AttachedProperties =
                        {
                            new GridProperties
                            {
                                Row     = 0,
                                Column  = 0,
                                RowSpan = 3
                            }
                        }
                    },
                    new Border
                    {
                        FrameStyle = FrameStyle.Single,
                        Content    = new TextView
                        {
                            Text = "2"
                        },
                        AttachedProperties =
                        {
                            new GridProperties
                            {
                                Row        = 0,
                                Column     = 1,
                                ColumnSpan = 2
                            }
                        }
                    },
                    new Border
                    {
                        FrameStyle = FrameStyle.Single,
                        Content    = new TextView
                        {
                            Text = "3"
                        },
                        AttachedProperties =
                        {
                            new GridProperties
                            {
                                Row    = 1,
                                Column = 1
                            }
                        }
                    },
                    new Border
                    {
                        FrameStyle = FrameStyle.Single,
                        Content    = new TextView
                        {
                            Text = "4"
                        },
                        AttachedProperties =
                        {
                            new GridProperties
                            {
                                Row    = 2,
                                Column = 2
                            }
                        }
                    }
                }
            };
            var btn = new Button
            {
                Text   = "Press me!",
                Height = ControlSizeType.MaxByContent
            };
            var text = new TextView
            {
                Text   = "Click count: 0",
                Height = ControlSizeType.MaxByContent,
                Name   = "clkCnt"
            };
            var clkCnt = 0;

            btn.Clicked += (o, e) => ((TextView)btn.ByName("clkCnt")).Text = $"Click count: {++clkCnt}";
            var box = new TextBox
            {
                TextWrapping = TextWrapping.Wrap,
                Text         = "Hello World!"
            };
            var view = new TextView
            {
                DataContext        = box,
                AttachedProperties =
                {
                    new GridProperties
                    {
                        Row = 1
                    }
                }
            };

            view.Bind(nameof(view.Text), "Text");
            var tabControlTest = new ContentWindow
            {
                Title   = "ContentWindow + TabControl2 Test (Prev: Shift+Tab)",
                Content = new TabControl
                {
                    Children =
                    {
                        new Tab
                        {
                            Title   = "TextView",
                            Content = new TextView
                            {
                                Text = "Read-only text!\n" + LongLorem
                            }
                        },
                        new Tab
                        {
                            Title   = "Vertical StackPanel",
                            Content = new StackPanel
                            {
                                Children =
                                {
                                    new Border
                                    {
                                        Content =
                                            new TextView
                                        {
                                            Text   = "Item #1",
                                            Height = ControlSizeType.MaxByContent
                                        },
                                        Height = ControlSizeType.MaxByContent
                                    },
                                    new Border
                                    {
                                        Content =
                                            new TextView
                                        {
                                            Text   = "Item #2",
                                            Height = ControlSizeType.MaxByContent
                                        },
                                        Height = ControlSizeType.MaxByContent
                                    },
                                    new Border
                                    {
                                        Content =
                                            new TextView
                                        {
                                            Text   = "Item #3",
                                            Height = ControlSizeType.MaxByContent
                                        },
                                        Height = ControlSizeType.MaxByContent
                                    },
                                    new Border
                                    {
                                        Content =
                                            new TextView
                                        {
                                            Text   = "Item #4",
                                            Height = ControlSizeType.MaxByContent
                                        },
                                        Height = ControlSizeType.MaxByContent
                                    }
                                }
                            }
                        },
                        new Tab
                        {
                            Title   = "Horizontal StackPanel",
                            Content = new StackPanel
                            {
                                Orientation = StackPanelOrientation.Horizontal,
                                Children    =
                                {
                                    new Border
                                    {
                                        Content =
                                            new TextView
                                        {
                                            Text  = "Item #1",
                                            Width = ControlSizeType.MaxByContent
                                        },
                                        Width = ControlSizeType.MaxByContent
                                    },
                                    new Border
                                    {
                                        Content =
                                            new TextView
                                        {
                                            Text  = "Item #2",
                                            Width = ControlSizeType.MaxByContent
                                        },
                                        Width = ControlSizeType.MaxByContent
                                    },
                                    new Border
                                    {
                                        Content =
                                            new TextView
                                        {
                                            Text  = "Item #3",
                                            Width = ControlSizeType.MaxByContent
                                        },
                                        Width = ControlSizeType.MaxByContent
                                    },
                                    new Border
                                    {
                                        Content =
                                            new TextView
                                        {
                                            Text  = "Item #4",
                                            Width = ControlSizeType.MaxByContent
                                        },
                                        Width = ControlSizeType.MaxByContent
                                    }
                                }
                            }
                        },
                        new Tab
                        {
                            Title   = "ScrollViewer",
                            Content = new ScrollViewer
                            {
                                Content = new TextView
                                {
                                    Text         = LongLorem,
                                    TextWrapping = TextWrapping.Wrap,
                                    Height       = ControlSizeType.MaxByContent
                                }
                            }
                        },
                        new Tab
                        {
                            Title   = "TextBox + Binding",
                            Content = new Grid
                            {
                                RowDefinitions =
                                {
                                    new GridSize(GridUnitType.Grow, 1),
                                    new GridSize(GridUnitType.Grow, 1)
                                },
                                Children =
                                {
                                    box,
                                    view
                                }
                            }
                        },
                        new Tab
                        {
                            Title   = "Button",
                            Content = new StackPanel
                            {
                                Children =
                                {
                                    new TextView
                                    {
                                        Text   = "Press that",
                                        Height = ControlSizeType.MaxByContent
                                    },
                                    btn,
                                    text
                                }
                            }
                        }
                    },
                    SelectedIndex = 0
                }
            };

            Console.Windows.Add(gridWindowTest);
            Console.Windows.Add(tabControlTest);
            Console.Start();
        }
Пример #4
0
 internal IconTextChevron(Bindable <string> iconBinding, Bindable <string> textBinding, Bindable <string> chevronBinding)
 {
     Text.Bind("Text", () => textBinding);
     Chevron.Bind("Text", () => chevronBinding);
     Icon.Bind("Path", () => iconBinding);
 }
Пример #5
0
 internal TitleIcon(Bindable <string> titleBinding, Bindable <string> iconBinding)
 {
     Title.Bind("Text", () => titleBinding);
     Icon.Bind("Path", () => iconBinding);
 }
Пример #6
0
 internal TextChevron(Bindable <string> textBinding, Bindable <string> chevronBinding)
 {
     Text.Bind("Text", () => textBinding);
     Chevron.Bind("Text", () => chevronBinding);
 }
Пример #7
0
 protected override void Bind(Health viewModel)
 {
     _bar.Bind(viewModel.Value);
     _text.Bind(viewModel.Value);
 }
Пример #8
0
 internal TitleDescription(Bindable <string> titleBinding, Bindable <string> descriptionBinding)
 {
     Title.Bind("Text", () => titleBinding);
     Description.Bind("Text", () => descriptionBinding);
 }
Пример #9
0
 internal TextIcon(Bindable <string> textBinding, Bindable <string> iconBinding)
 {
     Text.Bind("Text", () => textBinding);
     Icon.Bind("Path", () => iconBinding);
 }
Пример #10
0
 internal IndexText(Bindable <string> indexBinding, Bindable <string> textBinding)
 {
     Index.Bind("Text", () => indexBinding);
     Text.Bind("Text", () => textBinding);
 }
Пример #11
0
 internal IndexTitle(Bindable <string> indexBinding, Bindable <string> titleBinding)
 {
     Title.Bind("Text", () => titleBinding);
     Index.Bind("Text", () => indexBinding);
 }
Пример #12
0
 internal TitleChevron(Bindable <string> titleBinding, Bindable <string> chevronBinding)
 {
     Title.Bind("Text", () => titleBinding);
     Chevron.Bind("Text", () => chevronBinding);
 }