If I were using SL navigation system and the user would go to another page the Navigation system would destroy the previous page. And I believe, the ChildWindow also kills the object when you click on X or Ok or Cancel.
I want to use RADWindow and then have them start as users click on RADMenu, but I don't lots of object sitting in memory because there is still reference to them. What is the proper way to ensure when user closes a RADWindow, the object is closed too?
Thanks!
5 Answers, 1 is accepted
The RadWindow doesn't dispose anything when closed - it waits for the GC to clean the momory. As long as you have reference to it the GC will not collect it, so if you want to dispose a RadWindow and its content you should closed the window and clean all your references to it - the GC will do its job and dispose it properly.
Hope this answers your question.
Regards,Miroslav Nedyalkov
the Telerik team
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 Public Issue Tracking system and vote to affect the priority of the items.
The correct way to use the RadWindow control is to not include it into a page - just create it from the code behind. This way you will not need to do any additional cleanup when the window is closed if you don't have hard references to it.
Sincerely yours,Miroslav Nedyalkov
the Telerik team
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 Public Issue Tracking system and vote to affect the priority of the items.
I created a simple silverlight application which has a button. When I click the button, I create an instance of the RadWindow and call its Show method to display the window. I close the window again and ran WinDbg to debug.
I notice that the RadWindow instance is always referenced even though I have closed it.
this is what i'm seeing even though the Window is already closed. Any thoughts? ( I didn't even set the Content property)
DOMAIN(05CEF2B8):HANDLE(Pinned):26a12f8:Root: 0c6d4250(System.Object[])->
0b6f551c(System.Collections.Generic.List`1[[System.Object, mscorlib]])->
0b768b28(System.Object[])->
0b6ff0d4(Telerik.Windows.Controls.RadWindow)
I tried this issue out with the following code:
WeakReference referance;
public
MainPage()
{
InitializeComponent();
}
private
void
Button_Click(
object
sender, RoutedEventArgs e)
{
var popupwindow =
new
RadWindow();
referance =
new
WeakReference(popupwindow);
popupwindow.ShowDialog();
}
private
void
Button_Click_1(
object
sender, RoutedEventArgs e)
{
GC.Collect();
GC.WaitForPendingFinalizers();
GC.Collect();
MessageBox.Show(referance.IsAlive.ToString());
}
And it seems to work correctly - the first time I click the collect button I receive True, but the second time I receive False - that means that first time the GC didn't needed to collect the RadWindow control, but as it collects it the second time there shouldn't be any references to it.
All the best,Miroslav Nedyalkov
the Telerik team
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 Public Issue Tracking system and vote to affect the priority of the items.