RadWindow.ShowDialog doesn't stay on top

4 posts, 0 answers
  1. Alex
    Alex avatar
    2 posts
    Member since:
    Sep 2013

    Posted 10 Oct 2014 Link to this post

    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
  2. George
    Admin
    George avatar
    1332 posts

    Posted 15 Oct 2014 Link to this post

    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.

     
  3. UI for WPF is Visual Studio 2017 Ready
  4. Alex
    Alex avatar
    2 posts
    Member since:
    Sep 2013

    Posted 15 Oct 2014 in reply to George Link to this post

    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>
  5. George
    Admin
    George avatar
    1332 posts

    Posted 20 Oct 2014 Link to this post

    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.

     
Back to Top