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

Floating window over existing window - any ideas

4 Answers 88 Views
Docking
This is a migrated thread and some comments may be shown as answers.
Jonathan
Top achievements
Rank 1
Veteran
Jonathan asked on 25 Jun 2015, 04:54 PM

Any ideas how I can create a small floating window (modal) over and existing WPF window?

I want to show a digital clock on the window/form at all times.

 

thanks in advance

4 Answers, 1 is accepted

Sort by
0
Nasko
Telerik team
answered on 26 Jun 2015, 10:13 AM
Hello Jonathan,

What we could suggest you in order to achieve the desired is to create an instance of RadWindow and set its Owner property to the MainWindow before calling its ShowDialog method - thus the RadWindow will always be on top of their parent:
RadWindow window = new RadWindow();
...
window.Owner = this;
window.ShowDialog()

Hopes this helps.

Regards,
Nasko
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Jonathan
Top achievements
Rank 1
Veteran
answered on 26 Jun 2015, 10:53 AM

On showdialog I get

 

An unhandled exception of type 'System.InvalidOperationException' occurred in PresentationFramework.dll

Additional information: Cannot set Owner property to a Window that has not been shown previously.

 

 

      public DashBoard()
        {
            InitializeComponent();


            Clock clock = new Clock();
            clock.Owner = this;
            clock.ShowDialog();

 

Any ideas?  thanks!

0
Accepted
Nasko
Telerik team
answered on 26 Jun 2015, 11:21 AM
Hello Jonathan,

The thrown exception is an expected one as you are trying to set the Owner property to a Window that is not yet initialized and visualized completely. We suggested you to handle the Loaded event of the Window and create RadWindow inside it - thus it will be sure that the Window is completely loaded:
public MainWindow()
{
    InitializeComponent();
    this.Loaded += MainWindow_Loaded;
}
 
void MainWindow_Loaded(object sender, RoutedEventArgs e)
{
    RadWindow window = new RadWindow();
 
    window.Owner = this;
    window.Show();
}

Hopes this helps.

Regards,
Nasko
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Jonathan
Top achievements
Rank 1
Veteran
answered on 26 Jun 2015, 11:26 AM
thanks again!!!
Tags
Docking
Asked by
Jonathan
Top achievements
Rank 1
Veteran
Answers by
Nasko
Telerik team
Jonathan
Top achievements
Rank 1
Veteran
Share this question
or