Coder Social home page Coder Social logo

punker76 / mahapps.metro.simplechildwindow Goto Github PK

View Code? Open in Web Editor NEW
372.0 26.0 55.0 27.66 MB

A simple child window for MahApps.Metro

License: MIT License

C# 99.65% PowerShell 0.35%
mahapps metro c-sharp wpf wpf-mahapps xaml ui ui-design ux gui metro-application visual windows modern oss open-source hacktoberfest

mahapps.metro.simplechildwindow's Introduction


MahApps.Metro.SimpleChildWindow

MahApps.Metro.SimpleChildWindow

A simple child window for MahApps.Metro.

Supporting .NET Framework 4.6.2 and greater, .NET Core 3.0 and 3.1, .NET 5 (on Windows)



masterstatus devstatus

Getting started

The NuGet package contains an assembly with the ChildWindow class and the ChildWindowManager helper class inside.

Tools

We use these awesome tools to develop, Build and deploy MahApps.Metro.SimpleChildWindow.

Sponsoring

This framework is free and can be used for free, open source and commercial applications. MahApps.Metro and MahApps.Metro.SimpleChildWindow (all code, NuGets and binaries) are under the MIT License (MIT). It's tested, used and contributed by many awesome people. So hit the magic ⭐ button, we appreciate it!!! 🙏

The core team member(s), MahApps.Metro contributors and contributors in the ecosystem do this open source work in their free time. If you use MahApps.Metro a serious task, and you'd like us to invest more time on it, please donate. This project increases your income/productivity/usability too.

Become a sponsor and show your support to this open source project.

🙏 All OpenCollective (archived) Backers ❤️

Backers

Samples

Stretch with Margin

2014-12-13_23h46_00

Without Shadow

2014-12-13_23h46_16

AutoSize

2014-12-13_23h46_32

With Icon or IconTemplate

2014-12-14_21h20_55

License

The MIT License (MIT)

mahapps.metro.simplechildwindow's People

Contributors

dependabot-preview[bot] avatar fruchtzwerg94 avatar gitter-badger avatar punker76 avatar sobaarcier avatar swizzy avatar thoemmi avatar timunie avatar xwgli avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mahapps.metro.simplechildwindow's Issues

When closing a childwindow, the main window will not recieve hover info until clicked

hi,

Just something I noticed whilst using this. I have the main window open or close a child window when I press F10. If I open the child window, then close it again using F10, wherever the cursor is when I close the window will give all elements in the main window (buttons etc) the current cursor location in terms of hovering but will not update until the user click within the main window.

Example:
I press F10 top open child window. I position my curose above a button elemnt in the main window. I press F10 which closes the child window, and the button I am hovering has its hover effect. Then I move mouse about, but the button hover effect doesn't leave, and no other elements have their hover effects happen, until I click somewhere within the main window.

.net4.0 dll is not working for me

Hi,
I am playing with your control but looks like it is not building in my .NET 4.0 project. The both project versions from nuget seem to target .NET 4.5. Is it exclusively for .NET 4.5?

Thanks

Message dialog overlay is not displayed when SimpleChildWindow is involved.

Hello,
I some cases when the message dialog is shown using ShowMessageAsync() method the dark overlay is not displayed. In my own project it happens a lot of times, but is hard to reproduce all cases because I use a dll library, threads, ASP.NET Identity for login, large code file,... I have found a simple example when it happens, may be fixing this bug solves all cases.

This is my environment:

  • Windows 8.1 Pro (64 bits)
  • Visual Studio Ultimate 2013 Update 4

I'm using Mahapps stable libraies:

  • Mahapps.Metro 1.2.2.0
  • Mahapps.Metro.SimpleChildWindow 1.2.0.0

Here is the sample code to reproduce de issue (I don't know why, but I can't uplad it to this post):
http://1drv.ms/1JJWO5G

You can follow the 4 steps in the application, one for each button, and you will see this 3 message dialogs:

When step 1 button is clicked (fine):
01 fine dialog

When step 2 (show child window) and 3 buttons are clicked (improvable, the displayed overlay is because the child window is shown, but message dialog overlay is not displayed):
02 improvable dialog

And when the step 4 button is clicked (wrong):
03 wrong dialog

This issue is opened on Mahapps.Metro too:
MahApps/MahApps.Metro#2318

Child window appears "beneath" validation errors

I have a simple WPF app with "standard" WPF validation (i.e. IDataErrorInfo and ValidatesOnDataErrors ) enabled, and when opening the child window, the outlines left by validation errors appear on top of the child window (the field's stay below it).

screenshot 8

I have tried updating the Panel.ZIndex property to something extremely high (5000) and it does not resolve the issue.

Note that this may be an issue with MahApps.Metro's implementation of validation errors, so let me know if this should be raised in that repo, or if you need any more information.

Markup (trimmed) for ChildWindow:

 <s:ChildWindow
        IsOpen="{Binding Path=IsAboutWindowVisible}"
        HorizontalContentAlignment="Center"
        VerticalContentAlignment="Center"
        Padding="15"
        ChildWindowImage="Information"
        Title="Help/About"
        CloseOnOverlay="True"
        GlowBrush="{DynamicResource AccentColorBrush}">
</s:ChildWindow

Close() method raising error

I'm calling the

await ShowChildWindowAsync(windowA)
windowA.Close()
await ShowChildWindowAsync(windowA)

in succession, and getting the error "The provided child window is already visible in the specified window."

Do I need to await Close in anyway?

Validation Errors not displayed until user makes edits in child window

I love the child-window feature, but I can't get initial-validation-state-feedback to work.... I think it is a bug, or maybe I need advice on the usage of a property or feature?

Background
I have a view model, which implements INotifyDataErrorInfo, it has several properties and some validation conditions which cause the HasErrors flag to be set true, and the GetErrors function to return some results for some propeties

The problem
If I show a child window and set it's data context to an instance of the view-model with validation errors present they are not reported in the UI (no red borders and no fly-outs with text for the error details). e.g. for a textbox bound to a property in error.
When a user edits a text value so that it becomes valid, and then changes it again so it becomes invalid the red-border and text-flyout is seen. This indicates that it is not a template problem with missing AdornerDecorator.

After a bit of googling I have tried several routes to launch the child window, to see if this would make the error validation show when displayed (all have the same effect of "window is displayed, expected validation errors are not") including:

  1. Window is created as child of the main Mah Apps MetroWindow (the main window) via definition in the xaml where IsOpen bound to the property holding the instance of the view model - which is normally null, but set on user commencing an edit.
  2. Create new window instance from code behind, use data-bindings to set its data context.
  3. Create new window instance from code behind, set data context using code behind.
  4. Create new window instance from code behind, set data context in a child window's On Loaded event handler.

If I change my child window type from "ChildWindow" to be a regular "MetroWindow" or standard WPF "Window" the initial validation errors are observed as expected.

I am using the latest versions of the ChildWndow and MahApp theme libraries.

Any advice would be gratefully received.

AllowMove does not work.

I added a ChildWindow to my Mainwindow Content but the AllowMove property did not enable ChildWindow moving. Did I miss enabling something to get this feature working?

My current code:

<simpleChildWindow:ChildWindow IsOpen="{Binding IsChildWindowOpenOrNotProperty}" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch" Padding="15" AllowMove=true ChildWindowImage="Error" Title="TestChild 1"> <Grid> </Grid> </simpleChildWindow:ChildWindow>

Xaml Designer doesn't show ChildWindow

When I open the CoolChildWindow in Visual Studio 2013 I don't see the various content Elements such as Textbox etc. in the designer. All I see is a blue rectangle.

Is there a workaround for this or is this a XAML limitation?
coolchildwindow

await ChildWindowAsync does not block main thread

public async virtual void Execute(object parameter)
        {
            Debug.Assert(CanExecute(parameter));

            Part part = parameter as Part;

            ViewerWindow window = ViewerWindows.SelectPartTypeWindow;
            await (Application.Current.MainWindow as MetroWindow).ShowChildWindowAsync(window);

            if (window.DialogResult)
            {
                part.PartType = (window.ViewFrame.Content as SelectPartTypeView).SelectedPartTypeVM.SelectedPartType;
            }
            else
            {
                Debug.Fail("No part type selected, so reverting to SOLID");
                ViewerWindows.MessageWindow("Part Type was not selected so will default to Solid");
                part.PartType = PartType.Solid;
            }

            // Set the render colour based on the part type the user has (or has not!) chosen
            part.DefaultRenderColour = Part.RenderColours[part.PartType];
        }

In the following code I attempt to show a ChildWindow using 'ShowChildWindowAsync' and expect the await call to block until the window is closed. However, execution just continues on.

Have I used the API incorrectly? How do create a Modal ChildWindow which blocks execution until closed like the classic MessageBox.Show()?

The XAML for the ViewerWindow is:

<SimpleChildWindow:ChildWindow x:Class="Viewer.AM.Windows.ViewerWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:Metro="clr-namespace:MahApps.Metro.Controls;assembly=MahApps.Metro"
        xmlns:SimpleChildWindow="clr-namespace:MahApps.Metro.SimpleChildWindow;assembly=MahApps.Metro.SimpleChildWindow"
        xmlns:local="clr-namespace:Viewer.AM.Windows"
        mc:Ignorable="d"
        Style="{StaticResource ModalWindow}">
    <Frame x:Name="ViewFrame"/>
</SimpleChildWindow:ChildWindow>

and the ModalWindow style is:

<Style x:Key="ModalWindow" TargetType="SimpleChildWindow:ChildWindow">
        <Setter Property="Background" Value="{StaticResource GrowLightColourBrush}"/>
        <Setter Property="IconTemplate" Value="{DynamicResource WindowIconTemplate}"/>
        <Setter Property="IsModal" Value="True"/>
        <Setter Property="TitleBarBackground" Value="{StaticResource GrowLightColourBrush}"/>
        <Setter Property="TitleForeground" Value="Black"/>
    </Style>

StrongName signed assembly? Hey, it's 2017...

MahApps.Metro.SimpleChildWindow v1.5.0 will not be strong-named.

Why?

Strong-named assemblies are only useful in some rare scenarios. If you need strong-named assembly then you can compile the source by yourself ore use the Strong Namer from Daniel Plaisted @dsplaisted or Strong-Name Signer from Werner van Deventer @brutaldev.

More informations about the reason of this decision can be found here:

VS2013 crash

VS2013 crashed for me after I changed IsOpen parameter in XAML from false to true.

IsModal doesn't seem to have an effect

View:

<simpleChildWindow:ChildWindow x:Class="Views.InviteWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:system="clr-namespace:System;assembly=mscorlib"
        xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
        xmlns:simpleChildWindow="clr-namespace:MahApps.Metro.SimpleChildWindow;assembly=MahApps.Metro.SimpleChildWindow"
        Title="Invite New User" Height="200" Width="300" IsModal="True">

Calling code:

                var inviteWindow = new InviteWindow(emailAddress);
                var mainWindow = Application.Current.MainWindow as MainWindow;
                await mainWindow.ShowChildWindowAsync(inviteWindow);

With the above code I get the window appearing centered on the page. It does not cover the app with a translucent surface and mouse events are working fine so I can continue to interact with the application.

Keep child inside parent window

Hi,

I would like to ask if there is something wrong with what I do. I have adapted the example in the SimpleChildWindowDemo and I am trying to open movable child window like this:

           var detailWindow = new DetailWindow() { IsModal = true, AllowMove = true };

            var vm = new ProductDetailViewModel(detailWindow, payload);
            detailWindow.DataContext = vm;

            detailWindow.WindowPresenter.Content = new ProductDetailView(vm);
            await appWindow.ShowChildWindowAsync(detailWindow, appWindow.RootGrid);

DetailWindow looks like this:

<SimpleChild:ChildWindow x:Class="CategoryManager.Views.DetailWindow"
        xmlns:iconPacks="http://metro.mahapps.com/winfx/xaml/iconpacks"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:SimpleChild="clr-namespace:MahApps.Metro.SimpleChildWindow;assembly=MahApps.Metro.SimpleChildWindow"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:local="clr-namespace:CategoryManager.Views"
        mc:Ignorable="d"        
        ShowCloseButton="True"
        ShowTitleBar="True"
        CloseByEscape="True"                                         
        Width="auto"
        Height="auto"
        HorizontalContentAlignment="Left"
        VerticalContentAlignment="Top"        
        CloseButtonCommand="{Binding Path=CloseWindowCommand}"
        Title="Edit">

    <ContentPresenter x:Name="WindowPresenter"/>
</SimpleChild:ChildWindow>

The thing is that the opened child window can be dragged outside of bounds of parent window. In the demo application mouse movement stops at the border of the parent window.

What can I change to enforce the parent border window bounds?

ChildWindow closes on Escape pressed

Hi,

when i press Esc the ChildWindow gets closed. I tried to avoid this behavior with the OnKeyDown Event but this didn´t work. Are there any appproaches to avoid that the ChildWindow gets closed until i say it explicit from code.

ShowSimpleChildWindow in VB.Net

Hi,

I've a usercontrol named setupchildwindow, I've imported MahApps.Metro.Controls but I'm not able to use
"Me.ShowChildWindowAsync(new setupchildwindow())" how to make my childwindow appear ?

Thanks !

Multiple Window Childs Focus(Bring To Front) Problem

When i create multiple window childs and click on the back window child, It doesn't bring to front the other child.
ekran

Details:

Windows 8.1
Visual Studio 2015
Mahapps V.1.1.2.0
Mahapps SimpleChildWindow V.1.2.0.0

<simpleChildWindow:ChildWindow
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:simpleChildWindow="clr-namespace:MahApps.Metro.SimpleChildWindow;assembly=MahApps.Metro.SimpleChildWindow"
        xmlns:local="clr-namespace:HerkodOsgb.Moduller.Kullanicilar.Views"  
        xmlns:Models="clr-namespace:HerkodOsgb.Models"
        x:Class="HerkodOsgb.Moduller.Kullanicilar.Views.kullanicilar"
        GlowBrush="{DynamicResource AccentColorBrush}"
        BorderBrush="{DynamicResource AccentColorBrush}"
        BorderThickness="1"
        Title="Kullanıcılar"
        ShowCloseButton="True"
        CloseByEscape="True"
    >
    <simpleChildWindow:ChildWindow.Icon>
        <Rectangle Width="22"
                   Height="22"
                   Fill="{DynamicResource IdealForegroundColorBrush}">
            <Rectangle.OpacityMask>
                <VisualBrush Stretch="Uniform"
                             Visual="{DynamicResource appbar_group_add}" />
            </Rectangle.OpacityMask>
        </Rectangle>
    </simpleChildWindow:ChildWindow.Icon>
    <Grid Height="600" Width="1000">

    </Grid>
</simpleChildWindow:ChildWindow>
private async void Kullanicilar(object sender, RoutedEventArgs e)
        {
            await MahApps.Metro.SimpleChildWindow.ChildWindowManager.ShowChildWindowAsync(this, new Moduller.Kullanicilar.Views.kullanicilar() { IsModal = false, AllowMove = true }, RootGrid);
        }

Can't reopen SimpleChildWindow

Could you please help me? Once closed the window it does not reopen. With the code below you should be able to verify this behaviour.

It should open and close every 3 seconds but it never reopens.

Thanks for help!

In XAML:

simpleChildWindow:ChildWindow IsOpen="{Binding showwarning}"

In a task I run:

 while (true)
            {
                Thread.Sleep(3000);
                if (showwarning)
                { showwarning = false; Console.WriteLine("OFF"); }
                else
                { showwarning = true; Console.WriteLine("ON"); }
            }

showwarning is of type (typical wpf structure):

private bool _showwarning = false;
        public bool showwarning
        {
            get
            { return _showwarning; }
            set
            {
                //Console.WriteLine("change");
               // if (_showwarning == value) { return; }
                _showwarning = value;
                RaisePropertyChanged("showwarning");
            }
        }

Application hang with SCW

Hi Jan,

I saw that someone already ask you about that, but I would like to raise a hand that the problem exists ;)

When I want to change binding for IsOpen VS crash and there is nothing I can do with it. Event viewer shows only 1002 error with source: Application Hang.

Here you can find full event general info:

The program devenv.exe version 14.0.22823.1 stopped interacting with Windows and was closed. To see if more information about the problem is available, check the problem history in the Action Center control panel.
Process ID: 24c8
Start Time: 01d0888fc1814b40
Termination Time: 32
Application Path: C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\devenv.exe
Report Id: 2e089999-f483-11e4-827c-402cf4c7fed8
Faulting package full name:
Faulting package-relative application ID:

I was trying to fix it with sfc /scannow and then manully fix crashed files for VS - no result.

Thank you for any suggestions,

Create a short Wiki

Create a short Wiki from the already existing README with some simple examples.

InvalidOperationException when using from different threads

We have a scenario, where we have two main MetroWindows that can both show overlays. To show the overlay, we create a new instance of ChildWindow in the respective thread. When setting the content property the second time (first time in second thread), we receive an InvalidOperationException, stating that some SolidColorBrush was not frozen and may not be used across threads.

I have create a reproduction repo here:
https://github.com/pchinery/simplechildwindow-bugreport

You can start the application and follow the instructions on the screen ;-) (click a button to start the second thread and click a button in both windows to create the overlay)

If you have any questions or comments, please let me know

Stacked windowing

An ability to open a Dialog from within a Dialog.

Use case would be Prompting the user for input, then popping a second dialog with a list of issues against the input... this better catches the user's attention, esp. if its something drastic.

SimpleChildWindow does not behave like a ContentControl, Content can only be a Visual

v1.4.1

System.InvalidOperationException: 'xxxViewModel' is not a Visual or Visual3D.
   at MS.Internal.Media.VisualTreeUtils.AsVisual(DependencyObject element, Visual& visual, Visual3D& visual3D)
   at System.Windows.Media.VisualTreeHelper.GetChildrenCount(DependencyObject reference)
   at MahApps.Metro.SimpleChildWindow.Utils.TreeHelper.<GetChildObjects>d__4.MoveNext() in d:\projects\git\MahApps.Metro.SimpleChildWindow\src\MahApps.Metro.SimpleChildWindow\Utils\TreeHelper.cs:line 182
   at MahApps.Metro.SimpleChildWindow.Utils.TreeHelper.<FindChildren>d__3`1.MoveNext() in d:\projects\git\MahApps.Metro.SimpleChildWindow\src\MahApps.Metro.SimpleChildWindow\Utils\TreeHelper.cs:line 140
   at MahApps.Metro.SimpleChildWindow.Utils.TreeHelper.<FindChildren>d__3`1.MoveNext() in d:\projects\git\MahApps.Metro.SimpleChildWindow\src\MahApps.Metro.SimpleChildWindow\Utils\TreeHelper.cs:line 149
   at System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable`1 source, Func`2 predicate)
   at MahApps.Metro.SimpleChildWindow.ChildWindow.TryFocusElement() in d:\projects\git\MahApps.Metro.SimpleChildWindow\src\MahApps.Metro.SimpleChildWindow\ChildWindow.cs:line 692
   at MahApps.Metro.SimpleChildWindow.ChildWindow.<>c__DisplayClass131_0.<IsOpenedChanged>b__0() in d:\projects\git\MahApps.Metro.SimpleChildWindow\src\MahApps.Metro.SimpleChildWindow\ChildWindow.cs:line 659

Workaround

<metroWindow:ChildWindow>
    <ContentPresenter Content="{Binding Path=xxxViewModel, Mode=OneWay}"/>
</metroWindow:ChildWindow>

Text should be in "normal case" instead of upper case

Seems everything is converted uppercase by default. I think this is not user wants. If I want uppercases somewhere, I will convert it (or specify some property in style) myself.
By the way how to keep/set all widgets to use "normal case" (original case) ?

DialogManager throws InvalidOperationException when DialogMessage is shown in second time (Threads and SimpleChildWindow involved)

Hello,
I have been being a problem with message dialogs when I'm using threads and child windows. Here is exception's information:

System.InvalidOperationException

Message:
   Sequence contains more than one element

StackTrace:
   at System.Linq.Enumerable.SingleOrDefault[TSource](IEnumerable`1 source)
   at MahApps.Metro.Controls.Dialogs.DialogManager.AddDialog(MetroWindow window, BaseMetroDialog dialog) in C:\Users\punker76\Documents\GitHub\MahApps.Metro\MahApps.Metro\Controls\Dialogs\DialogManager.cs:line 423
   at MahApps.Metro.Controls.Dialogs.DialogManager.SetupAndOpenDialog(MetroWindow window, BaseMetroDialog dialog) in C:\Users\punker76\Documents\GitHub\MahApps.Metro\MahApps.Metro\Controls\Dialogs\DialogManager.cs:line 413
   at MahApps.Metro.Controls.Dialogs.DialogManager.<>c__DisplayClass2_0.<ShowMessageAsync>b__1() in C:\Users\punker76\Documents\GitHub\MahApps.Metro\MahApps.Metro\Controls\Dialogs\DialogManager.cs:line 172
   at System.Windows.Threading.DispatcherOperation`1.InvokeDelegateCore()
   at System.Windows.Threading.DispatcherOperation.InvokeImpl()

This is my environment:

  • Windows 8.1 Pro (64 bits)
  • Visual Studio Ultimate 2013 Update 4

I'm using Mahapps stable libraies:

  • Mahapps.Metro 1.2.2.0
  • Mahapps.Metro.SimpleChildWindow 1.2.0.0

I developed an application to show that:
http://1drv.ms/1PZTAu1

There are 4 buttons or steps. You can reproduce the issue in 4 ways, following one of these steps sequences (only clicking step buttons and closing message dialogs):

  • 1, 2, 2.
  • 1, 2, 3, 4.
  • 4, 4.
  • 4, 1, 2.

This issue is opened on Mahapps.Metro too:
MahApps/MahApps.Metro#2321

PART_HeaderThumb prevents icon click

Please move PART_HeaderThumb to Column 1 and remove ColumnSpan 2 so that it doesn't overlay the icon and prevent the ability to click it when AllowMove is true. Standard behavior of window icons is to provide a menu on click, and not the ability to drag and move the window.

Modify main form from SimpleChildWindow

Hi, I have a problem :
I'm trying to modify my main form with a Button on the SimpleChildWindow but it doesn't work.
I'm using this code in VB.Net :

Dim main As New MainWindow
Dim Nom As String = textbox1.Text
Dim Prenom As String = textbox2.Text
main.usernametext.Text = Nom & " " & Prenom

Here, usernametext is just a Label. The code give any error but nothing happens. Can I have help ?
Thank you !

Designer support

I don't know if this affects only me, but I don't have any designer support. All I have is a blank grid in the designer. I still have full XAML editor support.
no-designer-support

Mvvm example?

Can you add an example on how to use this from a view model?

Needs Mahapps.Metro 1.0.0.0

In VS I get the following error when using the latest prerelease of Mahapps.Metro (1.1.2.7).

Error 1 The type 'MahApps.Metro.Controls.MetroWindow' is defined in an assembly that is not referenced. You must add a reference to assembly 'MahApps.Metro, Version=1.0.0.0, Culture=neutral, PublicKeyToken=f4fb5a3c4d1e5b4f'.

This should be fixed.

CloseButton not visible with light mahapps theme

Hello, I recently started using your library and noticed that when a light theme is selected (LightBase) the close button is not visible because its also whiteish.
t1
t2

The second image is clicking the close button.

Child Window show a blank page in design time

this example in the wiki or any Child Window

<simpleChildWindow:ChildWindow
                 IsOpen="{Binding IsChildWindowOpenOrNotProperty}"
                 HorizontalContentAlignment="Stretch"
                 VerticalContentAlignment="Stretch"
                 Padding="15"
                 ChildWindowImage="Error"
                 Title="TestChild 1">
  <Grid>
<Button Width="100"></Button>
  </Grid>
</simpleChildWindow:ChildWindow>

show as a blank page in design time in visual studio 2017 15.5.7

https://imgur.com/a/DQ9QH

"Cannot perform this operation while dispatcher processing is suspended."

Edit: Setting AllowFocusElement="False" prevents the error from occurring, so it's definitely an issue with TryFocusElement.

I recently ran into a weird crash when using the SimpleChildWindow.

I have a datagridview in my main window. This datagridview is editable and it has a contextmenu with the option to launch a child window. If you edit a cell, then right click to bring up the contextmenu and choose the launch child window button, my application crashes with the error message in the title.

The exception is only thrown if you go directly from editing a cell to launching the child window. If you press enter to finish editing before opening the window, everything works as expected. I never ran into this issue myself, as I always press enter to commit after editing a cell, but some of my users went directly from editing to the right-click contextmenu.

The exception is a System.InvalidOperationException.

From the stack trace it looks like it might have something to do with the TryFocusElement in the ChildWindow class:

at System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame frame)
   at System.Windows.Threading.DispatcherOperation.Wait(TimeSpan timeout)
   at System.Windows.Threading.Dispatcher.InvokeImpl(DispatcherOperation operation, CancellationToken cancellationToken, TimeSpan timeout)
   at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
   at System.Windows.Controls.DataGrid.OnExecutedCommitEdit(ExecutedRoutedEventArgs e)
   at System.Windows.Controls.DataGrid.OnExecutedCommitEdit(Object sender, ExecutedRoutedEventArgs e)
   at System.Windows.Input.CommandBinding.OnExecuted(Object sender, ExecutedRoutedEventArgs e)
   at System.Windows.Input.CommandManager.ExecuteCommandBinding(Object sender, ExecutedRoutedEventArgs e, CommandBinding commandBinding)
   at System.Windows.Input.CommandManager.FindCommandBinding(Object sender, RoutedEventArgs e, ICommand command, Boolean execute)
   at System.Windows.Input.CommandManager.OnExecuted(Object sender, ExecutedRoutedEventArgs e)
   at System.Windows.UIElement.OnExecutedThunk(Object sender, ExecutedRoutedEventArgs e)
   at System.Windows.Input.ExecutedRoutedEventArgs.InvokeEventHandler(Delegate genericHandler, Object target)
   at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
   at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
   at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
   at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
   at System.Windows.UIElement.RaiseEvent(RoutedEventArgs args, Boolean trusted)
   at System.Windows.Input.RoutedCommand.ExecuteImpl(Object parameter, IInputElement target, Boolean userInitiated)
   at System.Windows.Input.RoutedCommand.Execute(Object parameter, IInputElement target)
   at System.Windows.Controls.DataGrid.EndEdit(RoutedCommand command, DataGridCell cellContainer, DataGridEditingUnit editingUnit, Boolean exitEditMode)
   at System.Windows.Controls.DataGrid.OnCurrentCellChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
   at System.Windows.DependencyObject.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
   at System.Windows.FrameworkElement.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
   at System.Windows.DependencyObject.NotifyPropertyChange(DependencyPropertyChangedEventArgs args)
   at System.Windows.DependencyObject.UpdateEffectiveValue(EntryIndex entryIndex, DependencyProperty dp, PropertyMetadata metadata, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType)
   at System.Windows.DependencyObject.SetValueCommon(DependencyProperty dp, Object value, PropertyMetadata metadata, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType, Boolean isInternal)
   at System.Windows.DependencyObject.SetCurrentValueInternal(DependencyProperty dp, Object value)
   at System.Windows.Controls.DataGrid.set_CurrentCellContainer(DataGridCell value)
   at System.Windows.Controls.DataGrid.set_FocusedCell(DataGridCell value)
   at System.Windows.Controls.DataGridCell.OnAnyLostFocus(Object sender, RoutedEventArgs e)
   at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
   at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
   at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
   at System.Windows.UIElement.RaiseEvent(RoutedEventArgs e)
   at System.Windows.UIElement.OnLostFocus(RoutedEventArgs e)
   at System.Windows.UIElement.IsFocused_Changed(DependencyObject d, DependencyPropertyChangedEventArgs e)
   at System.Windows.DependencyObject.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
   at System.Windows.FrameworkElement.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
   at System.Windows.DependencyObject.NotifyPropertyChange(DependencyPropertyChangedEventArgs args)
   at System.Windows.DependencyObject.UpdateEffectiveValue(EntryIndex entryIndex, DependencyProperty dp, PropertyMetadata metadata, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType)
   at System.Windows.DependencyObject.ClearValueCommon(EntryIndex entryIndex, DependencyProperty dp, PropertyMetadata metadata)
   at System.Windows.DependencyObject.ClearValue(DependencyPropertyKey key)
   at System.Windows.Input.FocusManager.OnFocusedElementChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
   at System.Windows.DependencyObject.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
   at System.Windows.FrameworkElement.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
   at System.Windows.DependencyObject.NotifyPropertyChange(DependencyPropertyChangedEventArgs args)
   at System.Windows.DependencyObject.UpdateEffectiveValue(EntryIndex entryIndex, DependencyProperty dp, PropertyMetadata metadata, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType)
   at System.Windows.DependencyObject.SetValueCommon(DependencyProperty dp, Object value, PropertyMetadata metadata, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType, Boolean isInternal)
   at System.Windows.Input.FocusManager.SetFocusedElement(DependencyObject element, IInputElement value)
   at System.Windows.Input.KeyboardNavigation.UpdateFocusedElement(DependencyObject focusTarget)
   at System.Windows.FrameworkElement.OnGotKeyboardFocus(Object sender, KeyboardFocusChangedEventArgs e)
   at System.Windows.Input.KeyboardFocusChangedEventArgs.InvokeEventHandler(Delegate genericHandler, Object genericTarget)
   at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
   at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
   at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
   at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
   at System.Windows.UIElement.RaiseTrustedEvent(RoutedEventArgs args)
   at System.Windows.UIElement.RaiseEvent(RoutedEventArgs args, Boolean trusted)
   at System.Windows.Input.InputManager.ProcessStagingArea()
   at System.Windows.Input.InputManager.ProcessInput(InputEventArgs input)
   at System.Windows.Input.KeyboardDevice.ChangeFocus(DependencyObject focus, Int32 timestamp)
   at System.Windows.Input.KeyboardDevice.TryChangeFocus(DependencyObject newFocus, IKeyboardInputProvider keyboardInputProvider, Boolean askOld, Boolean askNew, Boolean forceToNullIfFailed)
   at System.Windows.Input.KeyboardDevice.Focus(DependencyObject focus, Boolean askOld, Boolean askNew, Boolean forceToNullIfFailed)
   at System.Windows.Input.KeyboardDevice.Focus(IInputElement element)
   at System.Windows.UIElement.Focus()
   at MahApps.Metro.SimpleChildWindow.ChildWindow.<>c__DisplayClass104_1.<TryFocusElement>b__1(Object sender, DependencyPropertyChangedEventArgs args) in C:\Users\punker76\Documents\GitHub\MahApps.Metro.SimpleChildWindow\MahApps.Metro.SimpleChildWindow\MahApps.Metro.SimpleChildWindow\ChildWindow.cs:line 468
   at System.Windows.UIElement.RaiseDependencyPropertyChanged(EventPrivateKey key, DependencyPropertyChangedEventArgs args)
   at System.Windows.UIElement.OnIsVisibleChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
   at System.Windows.DependencyObject.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
   at System.Windows.FrameworkElement.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
   at System.Windows.Controls.TextBox.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
   at System.W...

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.