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

ListBox (SelectionChanged event) inside RadWindow

8 Answers 94 Views
Window
This is a migrated thread and some comments may be shown as answers.
Andrew
Top achievements
Rank 1
Andrew asked on 22 Apr 2009, 05:18 PM
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...

8 Answers, 1 is accepted

Sort by
0
Hristo
Telerik team
answered on 23 Apr 2009, 06:59 AM
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.
0
Andrew
Top achievements
Rank 1
answered on 23 Apr 2009, 03:12 PM
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?
0
Hristo
Telerik team
answered on 24 Apr 2009, 07:13 AM
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.
0
Andrew
Top achievements
Rank 1
answered on 24 Apr 2009, 04:18 PM
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();
}
0
Hristo
Telerik team
answered on 27 Apr 2009, 07:16 AM
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.
0
Andrew
Top achievements
Rank 1
answered on 27 Apr 2009, 04:08 PM
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.
0
Miroslav
Telerik team
answered on 30 Apr 2009, 03:48 PM
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.
0
Andrew
Top achievements
Rank 1
answered on 30 Apr 2009, 06:47 PM
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!
Tags
Window
Asked by
Andrew
Top achievements
Rank 1
Answers by
Hristo
Telerik team
Andrew
Top achievements
Rank 1
Miroslav
Telerik team
Share this question
or