Problem setting RadWindow property DestroyOnClose

6 posts, 0 answers
  1. Kazuyuki
    Kazuyuki avatar
    4 posts
    Member since:
    Nov 2010

    Posted 08 Dec 2010 Link to this post

    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.
  2. Konstantina
    Admin
    Konstantina avatar
    2332 posts

    Posted 10 Dec 2010 Link to this post

    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
  3. Kazuyuki
    Kazuyuki avatar
    4 posts
    Member since:
    Nov 2010

    Posted 29 Dec 2010 Link to this post

    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

  4. Konstantina
    Admin
    Konstantina avatar
    2332 posts

    Posted 04 Jan 2011 Link to this post

    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
  5. Kazuyuki
    Kazuyuki avatar
    4 posts
    Member since:
    Nov 2010

    Posted 06 Jan 2011 Link to this post

    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
  6. Konstantina
    Admin
    Konstantina avatar
    2332 posts

    Posted 11 Jan 2011 Link to this post

    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>>
Back to Top
  Cast Your Vote at DevPro Connections! Cast Your Vote at  Win IT Pro Connections!