punker76 / mahapps.metro.simplechildwindow Goto Github PK
View Code? Open in Web Editor NEWA simple child window for MahApps.Metro
License: MIT License
A simple child window for MahApps.Metro
License: MIT License
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:
I'm using Mahapps stable libraies:
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):
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):
And when the step 4 button is clicked (wrong):
This issue is opened on Mahapps.Metro too:
MahApps/MahApps.Metro#2318
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
<metroWindow:ChildWindow>
<ContentPresenter Content="{Binding Path=xxxViewModel, Mode=OneWay}"/>
</metroWindow:ChildWindow>
Can you add an example on how to use this from a view model?
When i create multiple window childs and click on the back window child, It doesn't bring to front the other child.
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);
}
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,
When using AllowMove=True
the dialog can be moved outside of view. It would be good, if moving the mouse cursor outside of the bounds of the parent window would be prevented, so that the child window can never completly go out of view.
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.
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>
if the child window flow direction is right to left while moving it by dragging, it will go to the opposite direction
https://github.com/punker76/MahApps.Metro.SimpleChildWindow/wiki/Samples#movable
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.
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.
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.
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 !
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.
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?
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:
The file MahApps.Metro.SimpleChildWIndow.pfx is missing from the latest sources. To get the ChildWindow to build I removed this file from the project and turned off code signing (temporarily).
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?
Create a short Wiki from the already existing README with some simple examples.
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) ?
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
it is working but SimpleChildWindow header is visible on top of my userControl dialog
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...
When child window is opened which smaller than main window. I am able to access controls in the main 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:
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.
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 !
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");
}
}
Buttons to Restore/Maximize Child Window.
It should had than also resize option but its another feature.
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:
I'm using Mahapps stable libraies:
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):
This issue is opened on Mahapps.Metro too:
MahApps/MahApps.Metro#2321
VS2013 crashed for me after I changed IsOpen parameter in XAML from false to true.
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).
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
How to show childwindow without shadow like this ?
https://user-images.githubusercontent.com/658431/28338628-dea5f8e2-6c09-11e7-8349-8bce5cf7a1c8.png
I can't figure it out;
this.ShowMessageAsync("Title", "Message");
Hello,
Is it just me or the closeButtonCommand only fire the first time you use it?
Second time, the windows close but nothing happens in the viewModel.
First of all, thank you for all the hard work, I love it.
I was wondering, is there a way to prevent focus to leave the ChildWindow context when Tab is pressed?
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.
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
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>
Make it available to change size of Child Window.
By:
-grabbing borders
-using grip in corner
Hi,
are you planning to allow call a childWindow from a ViewModel?
Thanks!
Hi,
I would like to ask if it's possible to add AutoClose to the SimpleChildWindow, just like Flyouts has in MahApps.Metro project? IsAutoCloseEnabled="True" with proper interval.
Thank you :)
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
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.