This is a migrated thread and some comments may be shown as answers.

RadWindow.ShowDialog doesn't stay on top

3 Answers 732 Views
Window
This is a migrated thread and some comments may be shown as answers.
Alex
Top achievements
Rank 1
Alex asked on 10 Oct 2014, 07:47 PM
Hi,

I'm using this code to show a modal RadWindow:

private void SendCommandExecuted(object parameter)
{
    PopupDeviceView popupDeviceView = new PopupDeviceView();
    PopupDeviceViewModel popupDeviceViewModel = (PopupDeviceViewModel)popupDeviceView.DataContext;
 
    RadWindow radWindow = new RadWindow();
    radWindow.Content = popupDeviceView;
    radWindow.WindowStartupLocation = WindowStartupLocation.CenterOwner;
    radWindow.ResizeMode = ResizeMode.NoResize;
    radWindow.CanClose = false;
    radWindow.CanMove = false;
 
    radWindow.ShowDialog();
}

it opens a RadWindow as modal, in the main window, but when I minimize that main window - my modal RadWindow dissapears, its only available with Alt+Tab windows keys - and only the main window is shown. And the worst - main window's button, that opened my RadWindow - can be hit with Enter key (not with mouse tho).

What should I do to make it trully 'modal'? TIA

3 Answers, 1 is accepted

Sort by
0
George
Telerik team
answered on 15 Oct 2014, 08:38 AM
Hello Alex,

I would suggest setting the RadWindow.Owner property to the MainWindow before opening:
...
radWindow.Owner = this;
 
radWindow.ShowDialog();

Please give it a try and let me know if this helps.

Regards,
George
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Alex
Top achievements
Rank 1
answered on 15 Oct 2014, 06:15 PM
Hi George,

thanks for your reply,
added what you suggested - but it doesn't help:
radWindow.Owner = ((UserControl)(((Button)(parameter)).ParentOfType<UserControl>()));

private void CommandRegisterEdit_Execute(object parameter)
{
    RadWindow radWindow = new RadWindow();
    radWindow.Owner = ((UserControl)(((Button)(parameter)).ParentOfType<UserControl>()));
    radWindow.Header = "Edit Register";
    radWindow.Content = popupRegisterView;
    radWindow.WindowStartupLocation = WindowStartupLocation.CenterOwner;
    radWindow.ResizeMode = ResizeMode.NoResize;
    radWindow.CanClose = false;
    radWindow.CanMove = false;
 
    radWindow.ShowDialog();
}



one more thing that possibly matters - the View that uses this ViewModel, is displayed in another, ShellView, like

<Window.Resources>
    <DataTemplate DataType="{x:Type vm:RegisterViewModel}">
        <v:RegisterView/>
    </DataTemplate>
</Window.Resources>
 
...
 
<DockPanel Grid.Row="1">
    <ContentControl Content="{Binding CurrentPageViewModel}"/>
</DockPanel>
0
George
Telerik team
answered on 20 Oct 2014, 08:19 AM
Hello Alex,

I tried to reproduce the problem, but to no avail. Can you refer to the attached project and let me know if there is anything I missed?

I am glad to assist you further.

Regards,
George
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
Window
Asked by
Alex
Top achievements
Rank 1
Answers by
George
Telerik team
Alex
Top achievements
Rank 1
Share this question
or