private void ShowWindow(RadWindow window)
{
WindowInteropHelper helper = new WindowInteropHelper(window);
helper.Owner = _windowHandle;
window.Show();
}
Thanks,
PT
13 Answers, 1 is accepted
You could get and use the Window when the RadWindow is loaded. Here is the sample code:
private
void
Button_Click(
object
sender, RoutedEventArgs e)
{
var myRadWindow =
new
RadWindow();
myRadWindow.Loaded +=
new
RoutedEventHandler(myRadWindow_Loaded);
myRadWindow.Show();
}
void
myRadWindow_Loaded(
object
sender, System.Windows.RoutedEventArgs e)
{
System.Windows.Window window = System.Windows.Window.GetWindow(sender
as
RadWindow);
if
(window ==
null
)
{
return
;
}
WindowInteropHelper helper =
new
WindowInteropHelper(window);
}
I hope this helps.
Best wishes,
George
the Telerik team
I have the same problem, and i tried your solution...
The problem is that i need the WindowsInteropHelper to set the Owner of my RadWindow, but if i do it in the Loaded event
i get this exception:
"Cannot set Owner property after Dialog is shown."
Apparently i need to set the Owner before the Loaded event, but i can´t get my WindowsInteropHelper before that.
Any suggestions?
Thanks
/Stefan E
Unfortunately, when a RadWindow is created, it is placed in a Window control. There is no way to get the window before the LoadedEvent handler. This is a limitation of the RadWindow at this stage.
We will definitely consider this scenario with the RadWindow control.
George
the Telerik team
It would be nice, if you implement event wich will be raised after back Window creation but before it shown. Usefull for System.Window tweaks.
For example here:
class
WindowHostBase<br>
{
//...
public
virtual
void
Open(
bool
isModal)
{
WindowHostBase.hosts.Insert(
this
.FindIndexToAdd(),
this
);
//<Raise event here>
}
//......
}
As i see it is generic method for all your host types(WindowWithNoChromeWindowHost / MockWindowHost / SinglePopupWindowHost).
Or just here
class
WindowWithNoChromeWindowHost<br>
{
//...
public
override
void
Open(
bool
isModal)
{
this
.PrepareHost();
this
.Host.Loaded +=
new
RoutedEventHandler(
this
.OnHostLoadedForFirstTime);
base
.Open(isModal);
//<Raise event here>
if
(isModal)
this
.Host.ShowDialog();
else
this
.Host.Show();
}
//...
}
Also this solves problems like: http://www.telerik.com/community/forums/wpf/window/radwindow-as-mainwindow.aspx
I would say that this is a good suggestion which we logged in our PITS here - http://www.telerik.com/support/pits.aspx#/public/wpf/13710 and we will consider implementing it for our further releases. Also, I am glad to update your telerik points as well.
George
the Telerik team
Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.
The feature request is not ignored, it's logged in our backlog system and we will look into it in our further releases. If it gets more votes, we will scheduled it for recent release. Also, we believe that the request is valid for both platforms (WPF and SL) as well.
George
the Telerik team
Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.
We moved the items from the PITS to the Feedback portal. You can find the same item on the following link:
http://feedback.telerik.com/Project/143/Feedback/Details/113558-add-event-which-is-raised-after-the-windowhost-creation
Hope this helps.
Regards,
Kalin
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.
We currently working on implementing the feature. Once it is done, we will update the Feedback item with the exact version of the controls. So please stay tuned.
If you have any other questions, please let us know.
Regards,
Kalin
Telerik