コード例 #1
0
        public Dialog(DialogStyle style) : base(style)
        {
            InternalChild.RowsProportions.Add(new Proportion());

            var buttonsGrid = new Grid()
            {
                ColumnSpacing       = 8,
                HorizontalAlignment = HorizontalAlignment.Right,
                GridRow             = 2
            };

            buttonsGrid.ColumnsProportions.Add(new Proportion());
            buttonsGrid.ColumnsProportions.Add(new Proportion());

            ButtonOk = new ImageTextButton
            {
                Text = "Ok"
            };

            ButtonOk.Click += (sender, args) =>
            {
                if (!CanCloseByOk())
                {
                    return;
                }

                Result = true;
                Close();
            };

            buttonsGrid.Widgets.Add(ButtonOk);

            ButtonCancel = new ImageTextButton
            {
                Text       = "Cancel",
                GridColumn = 1
            };

            ButtonCancel.Click += (sender, args) =>
            {
                Result = false;
                Close();
            };

            buttonsGrid.Widgets.Add(ButtonCancel);

            InternalChild.Widgets.Add(buttonsGrid);
        }
コード例 #2
0
ファイル: Dialog.cs プロジェクト: DadeKuma/Myra
        public Dialog(string styleName = Stylesheet.DefaultStyleName) : base(styleName)
        {
            var buttonsGrid = new HorizontalStackPanel()
            {
                Spacing             = 8,
                HorizontalAlignment = HorizontalAlignment.Right
            };

            ButtonOk = new ImageTextButton
            {
                Text = "Ok"
            };

            ButtonOk.Click += (sender, args) =>
            {
                if (!CanCloseByOk())
                {
                    return;
                }

                Result = true;
                Close();
            };

            buttonsGrid.Widgets.Add(ButtonOk);

            ButtonCancel = new ImageTextButton
            {
                Text       = "Cancel",
                GridColumn = 1
            };

            ButtonCancel.Click += (sender, args) =>
            {
                Result = false;
                Close();
            };

            buttonsGrid.Widgets.Add(ButtonCancel);

            InternalChild.Widgets.Add(buttonsGrid);
        }