New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Canceled Result To MessageDialogResut #2467

wants to merge 2 commits into
base: develop


None yet
4 participants

MatthewKinsman commented Apr 12, 2016

What changed?

I added a canceled state to MessageDialogResult enum. I had an issue with cross thread access when canceling the dialog. It would attempt to check ButtonStyle which is owned by another thread.


This comment has been minimized.


Deadpikle commented May 17, 2016

@MatthewKinsman -- You may also consider sending canceled if the user hits the 'Escape' key (see escapeKeyHandler) -- I needed it in both places for one of my use cases.


This comment has been minimized.


thoemmi commented May 18, 2016

I like the introduction of Canceled (and second @Deadpikle's suggestion for the Esc key). However, this is a major breaking change:
Users of MahApps.Metro would have to check each and every usage of MessageBox in their code. Their code still compiles, but the the MessageBox' result is now different. I think this is really dangerous.

My personal sidenote: I'd prefer Cancelled to Canceled, see Canceled vs. cancelled. However, even Microsoft is not consistent, there's AsyncCompletedEventArgs.Cancelled and BackgroundTaskInstance.Canceled.


This comment has been minimized.


punker76 commented May 18, 2016

@MatthewKinsman I'm also with @thoemmi . So this change should go to the dev-2.0.0 branch... or you/we wait until I finished the v1.3.0 which is .... nearly finished :-D

@punker76 punker76 added this to the 2.0.0 milestone Jun 19, 2016

@punker76 punker76 modified the milestones: 2.0.0, 1.6.0 Jan 14, 2018

@punker76 punker76 self-assigned this Jan 14, 2018

@punker76 punker76 closed this in a6d9853 Jan 14, 2018


This comment has been minimized.


punker76 commented Jan 14, 2018

The Canceled value is now added without breaking change, cause since #2619 "New Nullable Property MessageDialogResult? DialogResultOnCancel"

K3UL added a commit to K3UL/MahApps.Metro that referenced this pull request Sep 21, 2018

Updating codebase from official repo (#1)
* Move MetroDialogColorScheme and MetroDialogSettings to it's own files
  Update some xml comments

* Move classes in it's own files

* Update .DotSettings

* Add MetroDialogAutomationPeer

* Remove unnecessary using

* Add Canceled to MessageDialogResult
  Closes MahApps#2467

* Set a selected Item only if there is no content set

* Add `HamburgerMenu` resources to Control styles to allow style manipulation and fix binding expression infos

* Add FlyoutAutomationPeer for better CodedUI support

* Use DialogTitleFontSize and DialogMessageFontSize via DynamicResource at the base MetroDialog style

* Template binding
- to horizontal and vertical alignment
- to all content properties (inner content)
- to SnapsToDevicePixels

* Add AutomationProperties names
Template binding to Padding

* New (readonly) `IsAnyDialogVisible` dependency property
  This property will be updated if a dialog is shown or not

* - Remove internal close command and use the CloseTabItemAction
- Clear style and template for TabItem to prevent nasty binding expression errors
- Allow TabControlHelper dependency properties for TabItem too (brushes and Underlined property)

* TabControlHelper.Underlined makes only sense for TabControl

* Rename: IsAnyDialogVisible -> IsAnyDialogOpen

* - Pass correct dialogs settings to HandleOverlayOnShow
- New `CanCloseDialogOwner` property at `MetroDialogSettings` which can be used to handle how the owner of the dialog can be closed.
- New `IsCloseButtonEnabledWithDialog` property at `MetroWindow` which indicates if the close button should be enabled or not if a dialog is shown.

* - CanCloseDialogOwner -> `OwnerCanCloseWithDialog`
- Add trigger for `IsCloseButtonEnabledWithDialog` at WindowButtonCommands for PART_Close button
- `HandleOverlayOnHide` sets the `IsCloseButtonEnabledWithDialogPropertyKey` and restores focus if needed
- `HandleOverlayOnShow` sets the `IsCloseButtonEnabledWithDialogPropertyKey`

* Need Unwrap at HandleOverlayOnShow

* Fixed issue MahApps#3155 "GridViewColumnHeader uses twice the padding"!

* Closing main demo was wrong (TaskCanceledException)

* Update

* Set HorizontalScrollBarVisibility and VerticalScrollBarVisibility for HotKeyBox and NumericUpdDown to Hidden, cause the inner TextBox has this as default too

* Add a new property to handle the allowed numeric input:

- Add new `NumericInputMode` property with the new flag enumeration NumericInput (default is NumericInput.All)
- Mark `HasDecimals` as obsolete

* block scientific input if only numbers allowed

* MetroThumbContentControl: Catch exception and trace it

* Fix not focusing custom controls via FocusManager
  Problem: NumericUpDown, HotKeyBox and TimerPickerBase doesn't focus for the first time when the FocusManager will be used.

* HamburgerMenu: correct PanePlacement handling for right aligned
Update first showcase to change PanePlacement on the fly

* MetroWindow: New OverlayFadeIn and OverlayFadeOut properties to set the overlay fade in/out Storyboards

* Fix the fade in and out animation if no duration exists

* Slider: remove linear gradient brush from horizontal and vertical track value style
RangeSlider: fix margin of the middle thumb

* Add new Win10 Slider style
  - Style: `MahApps.Metro.Styles.Slider.Win10`
  - Control template: `MahApps.Metro.Styles.Slider.HorizontalTemplate.Win10`, `MahApps.Metro.Styles.Slider.VerticalTemplate.Win10`
  - RepeatButton: `MahApps.Metro.Styles.Slider.HorizontalTrack.Win10`, `MahApps.Metro.Styles.Slider.VerticalTrack.Win10`
  - Thumb: `MahApps.Metro.Styles.Slider.Thumb.Win10`

* Add new Slider style and mark old as obsolete
  - Style: `MahApps.Metro.Styles.Slider`
  - Control template: `MahApps.Metro.Styles.Slider.HorizontalTemplate`, `MahApps.Metro.Styles.Slider.VerticalTemplate`
  - RepeatButton: `MahApps.Metro.Styles.Slider.HorizontalTrack`, `MahApps.Metro.Styles.Slider.VerticalTrack`
  - Thumb: `MahApps.Metro.Styles.Slider.Thumb`
  - Brushes:
`MahApps.Metro.Brushes.SliderThumbBackground` default `Gray2`
`MahApps.Metro.Brushes.SliderTrackFill` default `Gray3`
`MahApps.Metro.Brushes.SliderTrackValueFill` default `AccentColor`

`MahApps.Metro.Brushes.SliderThumbBackgroundMouseOver` default `Gray5`
`MahApps.Metro.Brushes.SliderTrackFillMouseOver` default `Gray3`
`MahApps.Metro.Brushes.SliderTrackValueFillMouseOver` default `AccentColor`

`MahApps.Metro.Brushes.SliderThumbBackgroundPressed` default `Gray2`
`MahApps.Metro.Brushes.SliderTrackFillPressed` default `Gray3`
`MahApps.Metro.Brushes.SliderTrackValueFillPressed` default `AccentColor`

`MahApps.Metro.Brushes.SliderThumbBackgroundDisabled` default `Gray6`
`MahApps.Metro.Brushes.SliderTrackFillDisabled` default `Gray6`
`MahApps.Metro.Brushes.SliderTrackValueFillDisabled` default `Gray6`

* Remove DataTrigger from MahApps.Metro.Styles.Slider.Thumb

* Add new attached properties to SliderHelper for the Brushes

* Add `MahApps.Metro.Styles.RangeSlider` key
Use `SliderHelper` brush properties also for RangeSlider

* - Thump style for the middle part: `MahApps.Metro.Styles.RangeSlider.HorizontalMiddleThumb`, `MahApps.Metro.Styles.RangeSlider.VerticalMiddleThumb`
- Use `MetroThumb` instead `Thumb`
- Set ReservedSpace for all TickBar controls instead Margin

* New Win10 style for RangeSlider `MahApps.Metro.Styles.RangeSlider.Win10`

* Add FlatSlider resource dictionary to Controls resource dictionary

* DatePicker: add new dependency property `ControlsHelper.IsReadOnly`. This property sets the IsReadOnly property on the inner TextBox and the IsEnabled on the inner popup button.

* NumericUpdOwn:
- Validate and convert new value on lost focus only if the text was manually changed
- Fix interaction between `IsReadOnly` and `InterceptManualEnter`

* MetroWindow: use BorderThickness as Margin for inner window content

* Implements ToolTip on HamburgerMenuItem

* Updates HamburgerMenuItem ToolTip DependencyProperty to typeof(object)

* return (string)GetValue(ToolTipProperty); => return GetValue(ToolTipProperty);

* Add ability to set progress dialog progress bar brush color

* (MahAppsGH-3175) MetroWindow: improve BorderThickness usage

* (MahAppsGH-3175) MetroWindow: forgot the ShotTitleBar trigger to update the Grid rows for the overlays

* GetAncestors method added to TreeHelper.

Added one method to TreeHepler.
In every place where visual tree Ancestors are needed TreeHelper is used.

* MetroProgressBar:
- New style key `MahApps.Metro.Styles.MetroProgressBar`
- Fix layout rounding for both orientations
- Change style key to `MahApps.Metro.Styles.ProgressBar` and mark `MetroProgressBar` as obsolete
- Fix layout rounding for vertical orientation

* (MahAppsGH-2953) Can't run MahApps 1.5.0 Caliburn Demos on VS2015
- The `PrepareContainerForItemOverride` overrides the header properties with the `ItemTemplate`, `ItemTemplateSelector` and `ItemStringFormat` values. But in our case we want keep this values and want use the item template stuff for the content of the Flyout.

* SliderHelper: if the PreviewMouseWheel is used then it should also marked as handled, otherwise the event is bubbled to the next control

* Slider: a slider should be reached by tab, so set the IsTabStop property to true

* FlatSlider: fix the height and width of the Slider if the TickBars are visible

* Start reorganize the Sliders and Progress examples (not yet finished)

* FlatSlider: Add new style and mark old styles as obsolete
- Style: `MahApps.Metro.Styles.FlatSlider`
- Templates: `MahApps.Metro.Styles.FlatSlider.HorizontalTemplate`, `MahApps.Metro.Styles.FlatSlider.VerticalTemplate`
- TickBar style: `MahApps.Metro.Styles.FlatSlider.TickBar`
- Thumb style: `MahApps.Metro.Styles.FlatSlider.Thumb`
- Track style: `MahApps.Metro.Styles.FlatSlider.Track`

* RangeSlider: Add `Ticks` property MahApps#2879

* SliderHelper:
- Allow `SliderHelper.EnableMouseWheel` and `SliderHelper.ChangeValueBy` for `RangeSlider` too

* Selection properties for RangeSlider

* RangeSlider Win10: minor changes to pressed triggers for left and right edge

* Finished MahApps#3181
ProgressRing: Fix broken binding after set the IsActive property (must use SetCurrentValue)
ProgressBar: Set MinWidth and MinHeight for default style `MahApps.Metro.Styles.ProgressBar`

* typo

* (MahAppsGH-3039) NumericUpDown
- Fix not correct coerced value if min or max value was reached
- Fix manual change indication (e.g Tab is a non indicator)

* (MahAppsGH-1678) Fix Background for PivotItem in dark theme

Closes MahApps#1678

* appveyor: use GitVersion_NuGetVersion, zip Caliburn sample

* Update pakte and dependencies (Fody 2.3.25)

* Add WpfAnalyzers

* WPF0072: ValueConversion must use correct types.

* WPF0001: Backing field for a DependencyProperty should match registered name.

* WPF0004: CLR method for a DependencyProperty must match registered name.

* warning disable 618

* WPF0081: MarkupExtensionReturnType must use correct return type.

* WPF0011: Containing type should be used as registered owner.

* WPF0006: Name of CoerceValueCallback should match registered name.
WPF0007: Name of ValidateValueCallback should match registered name.

* WPF0043: Don't set DataContext using SetCurrentValue.

* WPF0016: Default value is shared reference type.
Suppress WPF0036: Avoid side effects in CLR accessors.

* WPF0005: Name of PropertyChangedCallback should match registered name.

* Add new CommandTriggerAction

* Add new CloseFlyoutAction and mark the internal command as obsolete

* WPF0041: Set mutable dependency properties using SetCurrentValue.

* WPF0050: XmlnsPrefix must map to the same url as XmlnsDefinition.
- use `mah` as XmlnsPrefix

* (MahAppsGH-3013) Fix ListView (ListBox) - Undeletable Top Padding
- Collapse `GridViewHeaderRowPresenter` if the TemplatedParent.View.Columns are null
Closes MahApps#3013

* build with cake

* yes, we have a build_script...

* Prepare build for GitReleaseManager

* Update

* Use GitVersion.CommandLine 4.0.0-beta0012

* Fix calculating CommitsSinceVersionSource

* Remove release docs from repo (moved to wiki)

* Fix release NuGet pack version

* appveyor: Tag.IsTag

* ComboBox: Remove unnecessary FocusBorder

* Readme: add tool logos, minor text changes

* Update ColorExample

* Readme: update screenshots

* typo

* GitVersion: Minor inc

* Fix NuGet release version

* Fixing branch name for appveyor badges

Branch name was "dev" where it should be "develop".

* (MahAppsGH-3202) Fix NU1602 Build Warning in 1.6.0

* Use VS2017 new project file and multi targeting (net40 - net47).

Change the main class library first (and remove the old ones).

* Minor changes in new csproj file
Update cake script

* Restoring NuGet project.assets.json via MSBuild

* Correct usage of MSBuild.Sdk.Extras

* try to convert MahApps.Metro.Demo

* try the latest tipps, but still not working with latest VS 15.6.3/15.6.4

* only workable with:

MSBuildSdkExtras 1.2.2
Paket 5.153.0
VS 2017 15.6.4
R# 2017.3.5
Self fixed project name vs assembly name

* Handle multiple App.config

* Add*

* TargetFrameworks should be also be added to csproj files

* Move projects directly under solution

* convert MahApps.Metro.Caliburn.Demo

* use MSBuild.Sdk.Extras 1.3.0

* convert MahApps.Metro.Tests

* Update Tests AssemblyInfo, set GlobalSuppressions

* use TargetFramework net40 for now until I know what's going wrong with higher frameworks

* typo: TargetFramework -> TargetFrameworks

* update paket

* (MahAppsGH-3192) Fix setting ShowTitleBar

* (MahAppsGH-3212) Fix Background hit testing for inactive ProgressRing

* (MahAppsGH-3227) ThemeManager: overloaded ctors and methods to allow add accent and theme with resource dictionaries instead URIs

* Use xUnit v2

* net47 and net46 not working for now

* (MahAppsGH-3227) ThemeManager: enable dynamic accents (and themes) to change on the fly

* Fix for Track's height inside Slider.

* (MahAppsGH-3238) fix FlatSlider height usage (works now together with vertical and horizontal content alignement)

* (MahAppsGH-3238) fix Slider and RangeSlider height usage too (works now together with vertical and horizontal content alignement)

* (MahAppsGH-3244) Left-/ RightWindowCommands no more visible when ShowTitleBar is False
  This feature will be there, but the window commands can now be used again to bring these back

* docs: added backers and sponsors from Open Collective

* set new major version to 2.0

* fix the backers avatars

* Remove obsolete marked code like properties and classes (part 1)

* Remove obsolete TestTitleCapsProperty

* Remove obsolete marked code like properties and classes (part 2)

* (MahAppsGH-3248) fix thumb in FlatSlider

(cherry picked from commit e864ee8)

* fix next version

* (MahAppsGH-2289) Rename TitlebarHeight to TitleBarHeight

* Update issue templates

* Fix binding warnings after removing obsolete marked code

* Update issue templates

* Delete

* Update

* Update

* (MahAppsGH-2763) DateTime instead TimeSpan for DateTimePicker/TimePicker (from @xxMUROxx)

* Fix IsClockVisible is not hiding the clock selectors (hout, min, sec)

* try to fix hanging tests (ApplicationFixture)

* update paket and dependencies (xunit runner prerelease)

* only .net 4.5 tests

* Removed the handling for non-digits within the textbox and allowed the user to specify the parsing number style.

* MSBuild.Sdk.Extras with global.json

* fix parsing input for numeric / hexadecimal and decimal values

* add tests for NumericUpDown

* (MahAppsGH-3189) Fix NumericUpDown Input Issues with StringFormat and parsing numbers

* (MahAppsGH-3272) Fix Wrong FileVersion and AssemblyVersion for v1.6.4

* (MahAppsGH-3280) Fix NumericUpDown doesn't handle percentages correctly

* update paket and to latest cake (inc. Cake.Paket)

* First step for generated themes

* Adjusting ThemeManager and everything else, except tests

* Fixing possible null-ref exception

* Restoring most ThemeManager tests

* Restoring all tests

* Renaming AccentHelper to ThemeHelper

* Switching to reference to XamlColorSchemeGenerator

* Fix HamburgerMenu IsEnabled false by default
The problem occurred when setting the property 'IsEnabled' to true, the
item became disabled. The problem was the CanExecute property should be true if
the Command is null (as specified in UpdateCanExecute()), but at the
initialization of the control, the local variable canExecute has the
default value false even if the Command is null. That leads to the
IsEnabledCoerceValueCallback returning false by default, so if the
IsEnabled property is set to any value (so the callback is triggered), it defaults to false.

* disable Fody in debug mode

* update paket and dependencies

* (MahAppsGH-3313) Fix for VS 15.8.1 update causes "Package is not compatible"

Closes MahApps#3313

* update editorconfig

* (MahAppsGH-3313) use temporary PackageReference instead Paket to allow VS 2017 build

* Remove NET40 and NET4 directives

* (MahAppsGH-3308) Fix TabItem HeaderFontSize change leads to freeze

* (MahAppsGH-3308) Use new extension method ExecuteWhenLoaded

* Update build cake script

* (MahAppsGH-3307) Change ListView default border thickness to zero

* (MahAppsGH-3265) Fix MetroDialogSettings is not settable within a style

* (MahAppsGH-3275) Fix TransitioningContentControl vs. ContentControl
  Changing ContentTemplate via triggers has no effect, cause the template was only set in code behind.

* no artifacts on PRs

* (MahAppsGH-3323) Fix CloseTabItemAction works only with MetroTabControl

* Use Win10 slider style at HamburgerMenu samples

* (MahAppsGH-3284) Fix Gap between menu items and hamburger icon

- add 2 new properties `PaneMargin` and `PaneHeaderMargin` to set the margin for Pane and PaneHeader (default is `0 0 0 8` for both properties)

* Rename `HamburgerMenuTemplate` to `HamburgerMenuButtonTemplate`

* (MahAppsGH-3239) Fix Customising HamburgerMenu

- rename `HamburgerMenuButtonTemplate` to `HamburgerButtonTemplate`
- add new property `HamburgerButtonStyle`

* Add appveyor nuget link to readme

* TabItem attached properties `HeaderFontSize`, `HeaderFontStretch` and `HeaderFontWeight` can now be set on the TabControl

* add a new attached property `HeaderFontFamily`

* (MahAppsGH-3329) Fix Windows 10 Maximize icon is slightly broken on high res displays

Closes MahApps#3329

* XamlStyler again

* Update

* (MahAppsGH-3332) Fix TransitioningContentControl defines a CornerRadius of 2 inside style

Use ControlsHelper.CornerRadius attached property for the inner border.

Closes MahApps#3332

* (MahAppsGH-3333) Fix TimePicker

- use SetCurrentValue to set new value for SelectedDateTime property to prevent broken bindings

Closes MahApps#3333

* Update paket

* Update paket dependencies and use ControlzEx v4.0 prerelease

* Use GlowWindowBehavior from ConrolzEx and remove old one

* ControlzEx v4.0.0-alpha0167

* ControlzEx v4.0.0-alpha0170

* Add TryToBeFlickerFree and KeepBorderOnMaximize to MetroWindow and set binding to properties of WindowChromeBehavior
Set TryToBeFlickerFree to true as default

* ControlzEx v4.0.0-alpha0171 (removed unused GlowBrushProperty)

* Remove old accent resource dictionaries

* Adjust version for ControlzEx NuGet dependency
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment