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

Problem setting RadWindow property DestroyOnClose

5 Answers 113 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Kazuyuki
Top achievements
Rank 1
Kazuyuki asked on 09 Dec 2010, 12:46 AM
Hello!
I have trouble setting the DestroyOnClose property.
Background:
I am using the Q3 Silverlight release and Expression Blend 4.
The reason for setting the property is that prevoiusly closed windows will reopen along with new windows,
causing multiple windows containing the same data to open instead of just one window.

I have a main Page called "Page" calling a new page "winMyWin" containing a radWindow.

My VB code goes as follows:
Page:
Dim myWindow = New winMyWin(Me, sender)
myWindow.Show()
....
ERROR --> myWindow.DestroyOnClose = True

winMyWin:
Partial Public Class winPwrCut
    Inherits RadWindow
    Public Sub New(caller As Object, sender As Object)
        InitializeComponent()
        ....
ERROR --> Me.DestroyOnClode = True

Problem is: I can not set the "DestroyOnClose" since it does not seem to be recognised.

5 Answers, 1 is accepted

Sort by
0
Konstantina
Telerik team
answered on 10 Dec 2010, 01:39 PM
Hello Kazuyuki,

Thank you for contacting us.

I am sorry, but the RadWindow does not support DestroyOnClose property. Could you please explain in details your scenario - how you are implementing the RadWindow?

In that way we will be able to assist you in the best manner.

Regards,
Konstantina
the Telerik team
Browse the videos here>> to help you get started with RadControls for Silverlight
0
Kazuyuki
Top achievements
Rank 1
answered on 29 Dec 2010, 06:04 PM
Hello!
I will try to explain how RadWindow is implemented.
I have a main Page called "Page" calling a new page "winMyWin" containing a radWindow.

My VB code goes as follows:
- PAGE "page" -
The page has paths that are assinged events as below.
Example path:
<Path Loaded="StylePL" Data="F1 M0.48000001,0.47999999 L0.48000001,9.6" x:Name="myPath_hyp_001" Canvas.Top="254.44" Canvas.Left="188.77" Height="10.08" Width="0.96"/>

Style set by "Loaded":
Private Sub StylePL(ByVal sender As Object, ByVal e As RoutedEventArgs)
        pt = sender
        Me.generalStyle(pt, e)
        Me.generalEvents("normal", pt, e)
End Sub

Events set by "StylePL":
Private Sub generalEvents(ByVal myShape As Object, ByVal e As RoutedEventArgs)
        Dim objType As String
        objType = getObjType(myShape)
       
        Select Case objType
            Case "Path"
                pt = myShape
                AddHandler pt.MouseEnter, AddressOf path_OnMouseEnter
                AddHandler pt.MouseLeave, AddressOf path_OnMouseLeave
                AddHandler pt.MouseLeftButtonDown, AddressOf showWindow_Click
            ...
       ...
End Sub

Click Event Sub:
Private Sub showWindow_Click(sender As Object, e As RoutedEventArgs)
        'Create and show new popup
        Dim myWindow = New winMyWin(Me, sender)
        myWindow.Show()
        'myWindow.DestroyOnClose = True
 End Sub

- PAGE "winMyWin" -
Partial Public Class winMyWin
    Inherits RadWindow
    Public Sub New(caller As Object, sender As Object)
        InitializeComponent()
        ....
  ...
End Class

0
Konstantina
Telerik team
answered on 04 Jan 2011, 09:51 AM
Hi Kazuyuki,

Thank you for the sample code.

As I mentioned in my previous post, the RadWindow doesn't support destroy on close functionality. More about this you can read in this forum post: http://www.telerik.com/community/forums/silverlight/window/destroy-on-close-functionality.aspx#1033429

Hope this information helps. Please let us know if you have additional questions.

Greetings,
Konstantina
the Telerik team
Browse the videos here>> to help you get started with RadControls for Silverlight
0
Kazuyuki
Top achievements
Rank 1
answered on 06 Jan 2011, 02:47 PM
OK, I see.
The main problem is that since the window cannot be destoyed, multiple identical windows are opened in certain cases.
Is there any suggested/recommended approach to avoid this behavior?
Can I, for example, get a handle for the window (ie. pass it to the main page on cose) and destroy the window manually?

For the time being I have made an extremely ugly work around involving an array containing
references to all opened windows to prevent the same window to open multiple times.

Best Regards,
Kazuyuki
0
Konstantina
Telerik team
answered on 11 Jan 2011, 01:21 PM
Hi Kazuyuki,

You can use the RadWindowManager class. It has a list of all open windows. You can make a property, which the first time creates a window and every other returns the same window.
 
Please let us know if you have further questions.

Kind regards,
Konstantina
the Telerik team
Let us know about your Windows Phone 7 application built with RadControls and we will help you promote it. Learn more>>
Tags
General Discussions
Asked by
Kazuyuki
Top achievements
Rank 1
Answers by
Konstantina
Telerik team
Kazuyuki
Top achievements
Rank 1
Share this question
or