ListBox (SelectionChanged event) inside RadWindow

9 posts, 0 answers
  1. Andrew
    Andrew avatar
    5 posts
    Member since:
    Apr 2009

    Posted 22 Apr 2009 Link to this post

    I apologize in advance if this has been covered.
    I have the latest version of RadControls, and the latest Silverlight install...

    My problem is, I have a RadWindow that I open from code behind... the content of the window is a user control that contains 2 ListBoxes. The SelectionChanged event causes some strange happenings. In debug mode, it doesn't throw any exception, but the applications stops... (screen goes blank) - in normal mode, the event just doesn't fire. When I query the selected item of the box, it is correct! But I really need the event, if for no other reason to debug events AFTER!

    Thanks in advance...

  2. Hristo
    Admin
    Hristo avatar
    832 posts

    Posted 23 Apr 2009 Link to this post

    Hello Andrew,

    This is know issue with Popups in Silverlight 2. Fortunately this is fixed in Silverlight 3. But there is a workaround for it in Silverlight 2 too. Just open RadWindow in the Page Loaded event. This way the Application RootVisual will be created and RadWindow will be able to attach its popup to it (thus preventing the exception).

    Let us know if you need more information.

    Kind regards,
    Hristo
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  3. DevCraft banner
  4. Andrew
    Andrew avatar
    5 posts
    Member since:
    Apr 2009

    Posted 23 Apr 2009 Link to this post

    Thanks for the response. I have tried this.
    I have tried pretty much everything I have found as a solution, but I still have the same problem.

    The ListBoxes work just fine, mouse events work just fine... It is just the one event, which throws an exception back to the DOM. I have tried opening the RadWindow in the _Loaded, I have tried opening it in the original Page_Loaded and then passing it over to the page that actually opens it... Everything.

    I guess my only real recourse here is to upgrade my app to Silverlight 3?
  5. Hristo
    Admin
    Hristo avatar
    832 posts

    Posted 24 Apr 2009 Link to this post

    Hi Andrew,

    Could you send us project demonstrating this issue?. When I open the window in page loaded I don't get exception when selecting ListBoxItems.

    Thanks.

    Greetings,
    Hristo
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  6. Andrew
    Andrew avatar
    5 posts
    Member since:
    Apr 2009

    Posted 24 Apr 2009 Link to this post

    I guess I need some further instruction.
    Here is my scenario...

    I am using RadTabControl on Page.xaml.
    Each tab has in it a different UserControl (different xaml)
    One of the controls has a button that opens up RadWindow. [PlaylistManagement.xaml]
    Inside RadWindow is another control (xaml) that has 2 ListBoxes. [ManagePlaylistContent.xaml]

    So, are you saying that I should instantiate RadWindow in PlaylistManagement.xaml.cs _Loaded?
    And then fire .Show() when the button is clicked? (that is what I am doing now, and I get the ListBox.SelectionChanged error)


    private RadWindow window; //class property

    private void PlaylistManagement_Loaded
    {
       window = new RadWindow();
       window.Content = new ManagePlaylistContent();
       (and other settings)
    }

    private void btnEditPlaylist_Click(object sender, RoutedEventArgs e)
    {
       window.DataContext = item; //item didn't exist until after the _Loaded so this is as soon as I can set it!
       window.Show();
    }
  7. Hristo
    Admin
    Hristo avatar
    832 posts

    Posted 27 Apr 2009 Link to this post

    Hello Andrew,

    What I was saying is that you need to open (call window.Show method) after the Application RootVisual is created. Otherwise you will get some exceptions from controls calling TransformToVisual method.
    The way you do it should work. Just small note: In your RootVisual (the first starting page) the child of the UserControl should be Panel. Is this your case?
    If you could send as simple project demonstrating this issue we might be able to help you faster.

    Sincerely yours,
    Hristo
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  8. Andrew
    Andrew avatar
    5 posts
    Member since:
    Apr 2009

    Posted 27 Apr 2009 Link to this post

    Interesting note. I created a project which uses a window to open a separate control...
    But I cannot recreate my error. I can't tell what the difference is, but I the basic components are the same.

    The only thing I can think of is that my app starts by loading a Login control. (rather than Page)
    Then when the user is authenticated, I use (in Login.xaml.cx) this.Content = new Page()

    Page is where everything else lives.
    The other difference is that the control which opens the window lives inside the RadTabControl.
  9. Miroslav
    Admin
    Miroslav avatar
    922 posts

    Posted 30 Apr 2009 Link to this post

    Hi Andrew,

    Sorry for the delayed reply!

    Unfortunately we could not reproduce this issue on our side.

    You can send us a sample project by opening a support ticket and we will get to the problem quickly.

    Alternatively you can send us the exception CallStack and the error message, so we can narrow down the problem. Also we need to know how and when you create your application root visual.

    Regards,
    Miroslav
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  10. Andrew
    Andrew avatar
    5 posts
    Member since:
    Apr 2009

    Posted 30 Apr 2009 Link to this post

    I actually figured out the problem. It had to do with the way I was changing pages. I was not changing the RootVisual, just the content.
    Thanks for the clues! I would have never figured it out!
Back to Top
DevCraft banner