Example #1
0
        private static Button CreateButton(ButtonDef def, Action callback)
        {
            var button = new Button {
                Content = def.Text,
                IsDefault = def.IsDefault,
                IsCancel = def.IsCancel,
                MinHeight = 21,
                MinWidth = 65,
                Margin = new Thickness(4, 0, 0, 0),
            };

            RoutedEventHandler handler = null;

            handler = (sender, args) => {
                button.Click -= handler;
                callback();
            };

            button.Click += handler;

            return button;
        }
Example #2
0
        private static Button CreateButton(ButtonDef def, Action callback)
        {
            var button = new Button {
                Content   = def.Text,
                IsDefault = def.IsDefault,
                IsCancel  = def.IsCancel,
                MinHeight = 21,
                MinWidth  = 65,
                Margin    = new Thickness(4, 0, 0, 0),
            };

            RoutedEventHandler handler = null;

            handler = (sender, args) => {
                button.Click -= handler;
                callback();
            };

            button.Click += handler;

            return(button);
        }