ChromelessWindow with Prism.DialogService

Hello,

I have a question how to use the ChromelessWindow with the Prism-DialogService.

With the Prism-DialogService I can use a new window as childwindow. When I create a ChromelessWindow and register it as DialogWindow then
I get the Error at closing the window "HWND is null" - means, the Owner of the childwindow  is null. 

Have anyone other the same problem and is there a solution to resolve the problem?

Many thanks

Ronny

15 Replies 1 reply marked as answer

VR Vijayalakshmi Roopkumar Syncfusion Team November 24, 2020 04:31 PM UTC

Hi Stoeckar 
 
Thank you for contacting Syncfusion Support. 
  
We have prepared a simple prism application with ChromelessWindow and refer it from following location:  
 
 
However please let us know how do you register the ChromelessWindow in Prism dialog . So that we could able to check and provide you the prompt solution on this. 
 
Please let us know if you need any further assistance on this. 
 
Regards, 
Vijayalakshmi VR  



SR Stoecker Ronny November 24, 2020 08:53 PM UTC

Hello, thank you for your answer.

Your sample descriped not the problem, what I mean.

I have a Prism-Application with a MainWindow and a ChildWindow. MainWindow is a ChromelessWindow. The ChildWindow should be a ChromelessWindow too. Now I must use Window as ChildWindow. There is the Problem, when I open the ChildWindow first, the Window use the Applicationtheme (SfSkinManager in the App.cs) and shown it correct. When I open the Window twice or more, then the theme will not shown correct.

The ChildWindow will registerd with 
containerRegistry.RegisterDialogWindow<ChildWindow>();

A UserControl (registered with containerRegistry.RegisterDialog<UserControl,UserControlViewModel>();) can now shown in the ChildWindow
with dialogService.ShowDialog("UserControl",new DialogParameters(),result () => {});

Now the problem with the ChildWindow as ChromelessWindow is, that, when I close the Window I got the error: HWND not found (means, the Owner is null).

Furter Informations to Prism DialogService:

https://prismlibrary.com/docs/wpf/dialog-service.html

I want to use ChromelessWindow in the ChildWindow, for shown the selected theme correct. 

Use SfSkinManger in the ChildWindow (as Window) and set the theme or set the theme in the UserControl will not help to show correct the theme.

Best regards

Ronny


VR Vijayalakshmi Roopkumar Syncfusion Team November 26, 2020 02:42 AM UTC

Hi Stoeckar

Thank you for your update.

We will try to prepare the sample according to your scenario and update you the complete details by 27th Nov, 2020.

Please let us know if you need any further assistance on this.

Regards,
Vijayalakshmi VR


VR Vijayalakshmi Roopkumar Syncfusion Team November 30, 2020 01:19 AM UTC

Hi Stoeckar

Thank you for your patience.

We are still preparing the sample according to your requirment. We will update you the details by 1st Dec, 2020.

We appreciate your patience until then.

Regards,
Vijayalakshmi VR


BR Bharathi Rajakantham Syncfusion Team December 6, 2020 04:38 PM UTC

Hi Stoeckar 


Thank you for your patience and sorry for the inconvenience, 


We are still preparing the sample according to your requirment. We will update you the details by 8th  Dec, 2020.
 


We appreciate your patience until then.

Regards,
 
Bharathi R 



SR Stoecker Ronny December 6, 2020 05:30 PM UTC

Hello,

Thank you for your efforts.

I'll be patient and I think,you'll find a great solution at the end.

Dear Regards

Ronny


VR Vijayalakshmi Roopkumar Syncfusion Team December 7, 2020 12:50 PM UTC

Hi Stoeckar

Thank you for your update.

Please let us know if you need any further assistance on this.

Regards,
Vijayalakshmi VR


SR Stoecker Ronny December 7, 2020 08:22 PM UTC

Hello,

Yes,I need further help with this.

My last message was only a reply on your last message from 12/06.

Best regards

Ronny


VR Vijayalakshmi Roopkumar Syncfusion Team December 10, 2020 02:58 AM UTC

Hi Stoecker 
 
Thank you for your patience. 
 
We have prepared the sample according to your requirement, but we are facing exception on trying to open the child window[ChromelssWindow] as shown in following screenshot: 
 
  
 
 
 
We are facing this exception and we did not face the error as you mentioned the owner is null.  So could you please observe our sample and let us know whether our replication is correct to reproduce your scenario. Also, could you let us know what does you mean by this sentence "Use SfSkinManger in the ChildWindow (as Window) and set the theme or set the theme in the UserControl will not help to show correct the theme". Are you setting the theme for second window and what theme you are trying to deploy it and how you are applying the theme. It would be helpful for us to proceed on it further. 
 
Regards, 
Vijayalakshmi VR 



SR Stoecker Ronny December 28, 2020 06:04 PM UTC

Hello, thank you, for your efforts.

Now, I found the time and prepared a sample for you, wich will explained, what is the problem and how you can use the Dialogservice from Prism.

In this sample open and close of the childwindow runs. So I search for the problem. I have a class, with options for the childwindow for a simple dialog and 
for a fullsized window. And there I have use the resizemode-option. And when I bind the window-resizemodeoption with the class option then I get the error at close the
window.

I solved the problem in codebehind with
this.SetBinding(Window.ResizeModeProperty, new Binding("ResizeMode") { Source = vm.WindowSettings, Mode = BindingMode.OneWay });

same with the Height and the Width-Property, wich are not bindable too.

Sorry for the time you must spend.

I wish you a very good new year 2021 and stay healthy

Ronny

Attachment: PrismDialogProjects_5b9f7d5.zip


VR Vijayalakshmi Roopkumar Syncfusion Team December 29, 2020 04:50 PM UTC

Hi Stoecker, 
 
Thank you for your update. 
 
We are currently checking the reported behavior with ChromelessWindow and update you the details by tomorrow [30th Dec, 2020] 
 
Please let us know if have any other concerns. 
 
Regards, 
Vijayalakshmi VR 



VR Vijayalakshmi Roopkumar Syncfusion Team December 30, 2020 02:01 PM UTC

Hi Stoeckar, 
 
Thank you for your update. 
 
Query :  I have a class, with options for the childwindow for a simple dialog and  
for a fullsized window. And there I have use the resizemode-option. And when I bind the window-resizemodeoption with the class option then I get the error at close the 
window. 
 
We have tried to replicate your scenario by bounding the ResizeMode property in ChromelessChildWindow as shown below: 
 
Code: 
 
 
<sync:ChromelessWindow 
    x:Class="ViewCoreModul.Views.ChromelessChildWindow" 
    xmlns:prism="http://prismlibrary.com/" 
    xmlns:sync="http://schemas.syncfusion.com/wpf" 
    Title="{Binding Title}" 
    Width="{Binding ChromeWidth, Mode=TwoWay}" 
    Height="{Binding Chromeheight, Mode=TwoWay}" 
    ResizeMode="{Binding Mode}"> 
    <Grid /> 
</sync:ChromelessWindow> 
 
 
 
 
At this scenario, we were able to reproduce the exception on closing the window. If this is the exception you faced as shown in following screenshot, we have confirmed it is a defect and logged a report on this. The patch for this fix is estimated to be available on 13th Jan 2021. You can track the status of this defect using the following feedback link: 
 
 
 
 
 
 
Query : same with the Height and the Width-Property, wich are not bindable too. 
 
We have tried to bound the height and width property in ChromelessChildWindow using the properties in ViewAViewModel , and it works as expected at our end. 
 
Code: 
 
 
<sync:ChromelessWindow 
    x:Class="ViewCoreModul.Views.ChromelessChildWindow" 
    xmlns:prism="http://prismlibrary.com/" 
    xmlns:sync="http://schemas.syncfusion.com/wpf" 
    Title="{Binding Title}" 
    Width="{Binding ChromeWidth, Mode=TwoWay}" 
    Height="{Binding Chromeheight, Mode=TwoWay}" 
 
 
 
 
So please check this and let us know if you still faces an binding problem . 
 
Regards, 
Vijayalakshmi VR 


Marked as answer

AR Artur May 1, 2024 10:03 AM UTC

Hi,


     How can the ChromelessWindow inherit the VisualStyle from the main window?

In Project1 from the sample ( https://www.syncfusion.com/downloads/support/directtrac/general/ze/PrismDialogProjects_Modified867248622.zip ), the OpenChromelessWindowCommand opens a dialog window, but the visual style is some default value - it does not inherit the style set at the MainWindowViewModel:

SfSkinManager.ApplyStylesOnApplication = true;

SfSkinManager.SetVisualStyle(Application.Current.MainWindow, (VisualStyles)Enum.Parse(typeof(VisualStyles), "MaterialDark"));


I've tested with the latest version of Syncfusion.SfSkinManager.WPF" (25.1.41).

Please let me know how I can have the same visual style as the main window.


Regards,

Artur




SE Sven Eichberger October 25, 2024 08:56 AM UTC

Hi Service Team,


I'm experiencing similar issues with prisms implementation of Dialogs. 

When I start the application the default is set to the Theme Windows11Light, the aforementioned dialog is represented correctly:

Image_8417_1729846210371

when I switch the Theme to Windows11Dark the Mainwindow does change all Elements Accordingly, but the Dialog does change the font settings but not the background and controls accordingly:

Image_5885_1729846313153

I did assume that it has something to do with Prisms Dialoghost (which is the visual parent of the dialog). So I did precautions in order to set the Theme for the Dialoghost accordingly but this does also not fix the issue:

Image_8591_1729846439623

As this did also not resolve the issue, I tried also to apply the theme in each dialog window, but this did also not fix the issue.

Unfortunately I cannot upload the solution since there is confidential Information within the solution.


Maybe your support can give an update on the Topic ?


Best regards

Sven



BS Bhaskar Suresh Syncfusion Team October 30, 2024 05:58 PM UTC

Hi,


To apply a theme globally in an application, set the ApplyStylesOnApplication property to True. This merges all the theme resource files into Application.Current.Resources. However, the attached properties Theme set in SfSkinManager will inherit to all controls in the visual tree but will not be notified for dynamically created windows (e.g., pop-up windows).


Since these are detachable visual elements, their style will only be changed by modifying the style property value directly. Other controls will have an overridden style if the style is merged into the resources without any key. Therefore, the style applied to the MainWindow will not apply to dynamically created windows. You need to set the theme for any new window created dynamically.


We have modified the sample to resolve the issue. Please find the attached sample for further reference.


Regards,

Bhaskar Suresh


Attachment: PrismDialogProjects_cba8fd30.zip

Loader.
Up arrow icon