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

ListBox in Window Fatal Error. No UserControl involved.

1 Answer 77 Views
Window
This is a migrated thread and some comments may be shown as answers.
Charlie
Top achievements
Rank 1
Charlie asked on 20 Jan 2009, 01:03 AM
I am constructing a small demo for my employeer, as we are considering to purchase a license for the Silverlight controls. 
This code is using the latest binaries (Trial version).

XAML:
        <Canvas x:Name="WindowSpace">               
            <telerikNavigation:RadWindow x:Name="MyWin">
                <ListBox x:Name="MyListBox" Width="300" Height="200"></ListBox>
            </telerikNavigation:RadWindow>
        </Canvas>

C#:
            MyListBox.Items.Add("First");
            MyListBox.Items.Add("Second");

            MyListBox.MouseLeftButtonDown += delegate
            {
                Telerik.Windows.Controls.RadWindow.Alert("Test");
            };

            MyWin.Show();

Result::
          Uncaught Sys.InvalidOperationException: Sys.InvalidOperationException: ManagedRuntimeError error #4004 in control 'Xaml1':           System.Exception: Oåterkalleligt fel (Exception from HRESULT: 0x8000FFFF (E_UNEXPECTED))
          And a blank screen in Google chrome.

The problem is associated with the events "SelectionChanged" and "MouseLeftButtonDown". 
If I use "MouseEnter" instead, it works.

But apparantely the problem was that "noticing that you are trying to use the RadWindow control as a UserControl".
That is not the case here. The XAML above is within Page.xaml. This was the simplest possible application I could make to raise the error. What is the work around? Is this fixed in the "full version"?


1 Answer, 1 is accepted

Sort by
0
Charlie
Top achievements
Rank 1
answered on 20 Jan 2009, 12:11 PM
Problem solved.

In a previous thread you meantioned that the windows should be opened no sooner than
this.RootVisual = new Page();

It appeares that if I Show(); the Window the Page() constructor, it crash. 
Adding a Loaded-event where i Show() the Windows to LayoutRoot solves the problem.
Tags
Window
Asked by
Charlie
Top achievements
Rank 1
Answers by
Charlie
Top achievements
Rank 1
Share this question
or