Skip to content

MahApps.Metro 1.4.0

Compare
Choose a tag to compare
@punker76 punker76 released this 22 Dec 23:10

Features / Changes / Fixes

  • Don't focus flyout on close #2671 (@ButchersBoy) This hack was introduced with #1805 which was noticed by manual testing.

  • Don't focus the FlyoutsControl

  • Fix another TopMost issue: If the window is top most and you switch to another window the top most will be gone.

  • Change icon for TimePicker #2700 (@p76984275)

  • Icon scaling #2667 (@thoemmi)

    • New property IconScalingMode to MetroWindow. It's forwarded to MultiFrameImage.MultiFrameImageMode to set the icon scaling.
      • MultiFrameImageMode.ScaleDownLargerFrame
        It takes the smallest frame which from the icon which has equal or larger size as the window's icon template. The frame is scaled down it's larger.
        image
      • MultiFrameImageMode.NoScaleSmallerFrame
        It takes the largest frame from the window which has equal or smaller size than the window's icon template. The frame is rendered centered if it's smaller.
        image
  • Changes for DateTimePicker and TimePicker #2710

    • Change DateTimePicker.SelectedDate to BindsTwoWayByDefault. The reason is that we do not have to use Mode=TwoWay explicit, and DatePicker.SelectedDate has BindsTwoWayByDefault too.
    • [Fix] Issue where Binding issues on DateTimePicker/TimePicker are shown on the output window
    • [Fix] Issue where Hour 0 is not shown when using 24h clock
    • Fix issue where clearing text does not immediately set value to null but 00:00:00 and 0001.01.01 00.00.00 respectively
    • Change icon for TimePicker #2700 (@p76984275)
    • Hide DateTimePicker and TimePicker on lost focus. Fix also Shift+Tab focus moving.
  • New SplitView and HamburgerMenu control #2704

  • New dependency properties for MetroWindow to set the brush and opacity for the overlay if a dialog is shown.

    • OverlayBrush sets the brush used for the dialog overlay.
    • OverlayOpacity sets the opacity used for the dialog overlay (0 = disabled, 1 = full overlay).
  • The TextBox's with the styles MetroButtonTextBox and SearchMetroTextBox can now use the button also if IsReadOnly="True" (only if the button command is set)

  • New AutoWatermark attached property at TextBoxHelper #2722 (@xxMUROxx) which is able to get the DisplayAttribute from the bound property in following cases:

    • Binding that is supported
      • "{Binding Path=Property}"
      • "{Binding Path=Property.SubProperty}"
      • "{Binding Path=CollectionProperty}"
      • "{Binding Path=CollectionProperty[0].SubProperty}"
    • Binding that is not supported
      • "{Binding Path=CollectionProperty[0]}"
    • This property is available for TextBox, ComboBox, NumericUpDown, DatePicker, TimePicker and DateTimePicker
  • Flyout changes for better Margin usage

    • This changes affects only users who used the sample from the source which shows how to use the FlyoutsControl actual width and a Margin for the Flyout
    • It's now possible to work without the actual width and use only the Margin or HorizontalContentAlignemnt for Left/Right and VerticalContentAnlignment for Top/Bottom Flyout.
      • Margin="200 30 0 0" and Position="Right" Flyout with left an top Margin
      • HorizontalContentAlignment="Stretch" and Position="Right" Flyout which covers the whole window
  • Changed style names (and changes, see #2767) for

    • Default Button (ButtonBase) -> MahApps.Metro.Styles.MetroButton
    • Default ToggleButton -> MahApps.Metro.Styles.MetroToggleButton
  • Fixed Expander closing animation and make it possible to change both animations (expand and collapse). #2769 (@ Alkalinee)

  • Updated TabControl and TabItem style for VS #2768

    • Handle TabStripPlacement
    • Default close button action (no closing event yet)
  • TextBox ContextMenu changes #2772, #2758 by @Deadpikle

    • If you want to use the default context menu items cut, copy and paste you must do nothing
    • If you want to use your own context menu items without the default items you must do this
    <TextBox Text="Yeahh">
        <TextBox.ContextMenu>
            <ContextMenu>
                <MenuItem Header="This is only a Test-Item" />
            </ContextMenu>
        </TextBox.ContextMenu>
    </TextBox>
    • If you want to use your own context menu items with the spell checker items then you must do this
    <TextBox Margin="{StaticResource ControlMargin}"
            Controls:TextBoxHelper.IsSpellCheckContextMenuEnabled="True"
            Text="Enabled">
        <TextBox.ContextMenu>
            <ContextMenu>
                <MenuItem Header="This is only a Test-Item" />
            </ContextMenu>
        </TextBox.ContextMenu>
    </TextBox>
    • If you want to use your own context menu items with the deafult items then you must do this
    <TextBox Controls:TextBoxHelper.ClearTextButton="True"
            Controls:TextBoxHelper.UseFloatingWatermark="True"
            Controls:TextBoxHelper.Watermark="Watermark">
        <TextBox.ContextMenu>
            <ContextMenu>
                <MenuItem Header="Custom Item" />
                <Separator />
                <MenuItem Style="{DynamicResource MetroMenuItem}" Command="ApplicationCommands.Cut" />
                <MenuItem Style="{DynamicResource MetroMenuItem}" Command="ApplicationCommands.Copy" />
                <MenuItem Style="{DynamicResource MetroMenuItem}" Command="ApplicationCommands.Paste" />
            </ContextMenu>
        </TextBox.ContextMenu>
    </TextBox>
  • CustomDialog improvements #2775

    • New overloaded generic method ShowMetroDialogAsync to create and show custom dialogs (self created dialogs which are inherited from CustomDialog)
    // create and show a new custom dialog of the given type with the default dialog settings
    var customBaseMetroDialog = await this.ShowMetroDialogAsync<CustomBaseMetroDialog>();
    
    // create and show a new custom dialog of the given type with own settings
    var customBaseMetroDialog = await this.ShowMetroDialogAsync<CustomBaseMetroDialog>(this.metroDialogSettings);
    • Better handling for dialogs settings also with the already available ShowMetroDialogAsync method
    // create and show custom dialog with default settings
    await this.ShowMetroDialogAsync(new CustomBaseMetroDialog());
    
    // create and show custom dialog with own settings
    await this.ShowMetroDialogAsync(new CustomBaseMetroDialog(this.metroDialogSettings));
    // or
    await this.ShowMetroDialogAsync(new CustomBaseMetroDialog(this, this.metroDialogSettings));
    • It's now also possible to configure the dialog settings at the custom dialogs class itself.
    protected override MetroDialogSettings ConfigureSettings(MetroDialogSettings settings)
    {
        return new MyCustomDialogSettings();
    }
    • Here is the source for the given samples
    <dialogs:CustomDialog x:Class="ShowMetroDialogAsyncIssue.CustomBaseMetroDialog"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:dialogs="clr-namespace:MahApps.Metro.Controls.Dialogs;assembly=MahApps.Metro"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
        mc:Ignorable="d" 
        d:DesignHeight="300" d:DesignWidth="300"
        Title="CustomBaseMetroDialog">
        <StackPanel>
            <TextBlock Text="This is a custom dialog based on BaseMetroDialog" />
            <Button Click="Close_OnClick">Close</Button>
        </StackPanel>
    </dialogs:CustomDialog>
    namespace ShowMetroDialogAsyncIssue
    {
        using System.Windows;
        using MahApps.Metro.Controls;
        using MahApps.Metro.Controls.Dialogs;
    
        public partial class CustomBaseMetroDialog : CustomDialog
        {
            public CustomBaseMetroDialog()
            {
                InitializeComponent();
            }
    
            public CustomBaseMetroDialog(MetroDialogSettings settings) : base(settings)
            {
                InitializeComponent();
            }
    
            public CustomBaseMetroDialog(MetroWindow parentWindow, MetroDialogSettings settings) : base(parentWindow, settings)
            {
                InitializeComponent();
            }
    
            private void Close_OnClick(object sender, RoutedEventArgs e)
            {
                (this.OwningWindow ?? (MetroWindow)Application.Current.MainWindow).HideMetroDialogAsync(this);
            }
        }
    }

Closed Issues / Pull Requests

  • #2674, #2671 Null Reference Exception in BorderlessWindowBehavior.TopMostChangeNotifierOnValueChanged (@mikeasage)
  • #2671 Proposal - Dont focus flyout on close
  • #2699 [Suggestion] TimePicker & DateTimePicker Icon
  • #2480 Windows 10 SplitView
  • #2715 Center mouse click crashes applications on some PCs with an Arithmetic Overflow Exception
  • #1709 Disable transparency or hide controls in background
  • #2497 Custom dialog background and foreground
  • #2720 DateTimePicker does not hides for Date Change
  • #2713 Weird animation on combobox with only one item
  • #2746 WindowCommands - Toggle Button And Button Access Key Not Underlined When Pressing Alt
  • #2744 Flyout IsPinned = False/True
  • #2737 Design for textbox
  • #2678 SearchMetroTextBox style, IsReadOnly
  • #2435 BackgroundToForegroundConverter returning color may be changed in some accents?
  • #2712 TextBox "Auto" Watermark-text
  • #2694 Maximized Window is "Always on Top" when IgnoreTaskbarOnMaximize=True. Window remains "Always on Top" on Restore
  • #2734 Mahapps UI is locked in Dialog Window after re-login
  • #2338 Impossible to toggle the visibility of TitleBar with UseNoneWindowStyle!
  • #2750 Fix for FlipView : Navigation's button visibility and Transition update
  • #2216 Flyout with a margin does not slide out properly
  • #2752 Unable to change the MessageDialog highlighted button
  • #2687 Implement SecureStrng into LoginDialogData and ShowLoginDialog
  • #2756 Flyout Position top element focus inhibited by title bar
  • #2755 MetroAnimatedTabControl first tab font not changing
  • #2760 DatePicker SelectionBackground doesn't match accent color
  • #2766 Flyout - Strange issue with a listview
  • #2767 Button Border not Transparent when Focused.
  • #2346 TabControl with VS style
  • #2090 VS TabItem
  • #1890 How do i use the CloseCommand in StandardTabControl with VS Style
  • #2261 ComboBox context menu.
  • #2774 Fix DataGridRowHeader HorizontalAlignment
  • #2735 MetroWindow.ShowMetroDialogAsync odd behaviour with provided DialogSettings