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

Select Listbox content inside RadWindow = catastrophic failure

3 Answers 198 Views
Window
This is a migrated thread and some comments may be shown as answers.
Nic
Top achievements
Rank 1
Nic asked on 18 Nov 2008, 08:26 PM
Hi,

I have a RadWindow with a listbox as part of the content. When an item in the listbox is selected a catastrophic failure occurs (below). I'd appreciate help on whether this is a bug or if I should be doing things differently.

Error: Unhandled Error in Silverlight 2 Application Catastrophic failure (Exception from HRESULT: 0x8000FFFF (E_UNEXPECTED))   at MS.Internal.XcpImports.MethodEx(IntPtr ptr, String name, CValue[] cvData)
   at MS.Internal.XcpImports.MethodPack(IntPtr objectPtr, String methodName, Object[] rawData)
   at MS.Internal.XcpImports.UIElement_TransformToVisual(UIElement element, UIElement visual)
   at System.Windows.UIElement.TransformToVisual(UIElement visual)
   at System.Windows.Controls.Primitives.Selector.IsOnCurrentPage(Int32 index, Rect& itemsHostRect, Rect& listBoxItemRect)
   at System.Windows.Controls.Primitives.Selector.ScrollIntoView(Int32 index)
   at System.Windows.Controls.Primitives.Selector.SetFocusedItem(Int32 index, Boolean scrollIntoView)
   at System.Windows.Controls.ListBox.OnSelectionChanged(Int32 oldIndex, Int32 newIndex, Object oldValue, Object newValue)
   at System.Windows.Controls.Primitives.Selector.OnSelectionChanging(Int32 oldIndex, Int32 newIndex, Object oldValue, Object newValue)
   at System.Windows.Controls.Primitives.Selector.OnSelectedIndexChanged(Int32 oldIndex, Int32 newIndex)
   at System.Windows.Controls.Primitives.Selector.OnSelectedIndexChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
   at System.Windows.DependencyObject.RaisePropertyChangeNotifications(DependencyProperty dp, Object newValue, Object oldValue)
   at System.Windows.DependencyObject.SetValueInternal(DependencyProperty dp, Object value, Boolean allowReadOnlySet, Boolean isSetByStyle, Boolean isSetByBuiltInStyle)
   at System.Windows.DependencyObject.SetValueInternal(DependencyProperty dp, Object value)
   at System.Windows.DependencyObject.SetValue(DependencyProperty property, Int32 i)
   at System.Windows.Controls.Primitives.Selector.set_SelectedIndex(Int32 value)
   at System.Windows.Controls.Primitives.Selector.NotifyListItemSelected(ListBoxItem listBoxItem, Boolean isSelected)
   at System.Windows.Controls.ListBoxItem.OnIsSelectedChanged(Boolean oldValue, Boolean newValue)
   at System.Windows.Controls.Primitives.Selector.OnIsSelectedChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
   at System.Windows.DependencyObject.RaisePropertyChangeNotifications(DependencyProperty dp, Object newValue, Object oldValue)
   at System.Windows.DependencyObject.SetValueInternal(DependencyProperty dp, Object value, Boolean allowReadOnlySet, Boolean isSetByStyle, Boolean isSetByBuiltInStyle)
   at System.Windows.DependencyObject.SetValueInternal(DependencyProperty dp, Object value)
   at System.Windows.DependencyObject.SetValue(DependencyProperty property, Boolean b)
   at System.Windows.Controls.ListBoxItem.set_IsSelected(Boolean value)
   at System.Windows.Controls.ListBoxItem.OnMouseLeftButtonDown(MouseButtonEventArgs e)
   at System.Windows.Controls.Control.OnMouseLeftButtonDown(Control ctrl, EventArgs e)
   at MS.Internal.JoltHelper.FireEvent(IntPtr unmanagedObj, IntPtr unmanagedObjArgs, Int32 argsTypeIndex, String eventName)

A search on google for similar problems indicate the listbox needs to be on the visual tree (eg. https://silverlight.net/forums/p/41636/117267.aspx). I have tried the same for my app and the problem does not appear with the same content in a stackpanel inside the root visual.

System info:
OS: WinXP SP2
Browser: Firefox 3.0.4; IE 7.0
Silverlight: 2 RTW
Telerik rad controls for Silverlight 2008.3 1105

File#1 PopupWindow.xaml

<UserControl x:Class="PopupWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:telerik="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.Navigation"
    Width="120" Height="90">
    <Grid x:Uid="LayoutRoot" x:Name="LayoutRoot" Background="White">

        <telerik:RadWindow x:Uid="window" x:Name="window"
                           WindowStartupLocation="CenterScreen" TopOffset="0" LeftOffset="0"
                           WindowState="Normal" ResizeMode="NoResize" PinMode="NoPin" CloseMode="Close"
                           WindowAnimation="OnShow"
                           Background="AliceBlue"
                           Header="">
        </telerik:RadWindow>
    </Grid>
</UserControl>






File#2 PopupOpenWL.xaml

<UserControl x:Class="PopupOpenWL"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"    
    >
    
    <Grid x:Uid="LayoutRoot" x:Name="LayoutRoot">
        
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="Auto" />
            <ColumnDefinition Width="*" />
        </Grid.ColumnDefinitions>
        
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>
        
        <TextBlock x:Uid="tblWatch" x:Name="tblWatch" Grid.Row="0" Grid.Column="1" Text="Watch" Margin="5,5,5,0"/>
        
        <StackPanel Grid.Row="1" Grid.Column="0" Margin="5, 5, 20, 5">            
            <RadioButton x:Uid="rbtnPersonal" x:Name="rbtnPersonal" Content="Personal" Click="rbtnPersonal_Click" />
            <RadioButton x:Uid="rbtnPublic" x:Name="rbtnPublic" Content="Public" Click="rbtnPublic_Click"/>
            <RadioButton x:Uid="rbtnTopPerformers" x:Name="rbtnTopPerformers" Content="Top Performers" Click="rbtnTopPerformers_Click"/>
        </StackPanel>

        <StackPanel Grid.Row="1" Grid.Column="1" Margin="5,2,5,5">
            <ListBox x:Uid="lbxWatch" x:Name="lbxWatch" MinHeight="200" Width="300"  SelectionChanged="lbxWatch_SelectionChanged">
            </ListBox>
        </StackPanel>

        <StackPanel Grid.Row="2" Grid.ColumnSpan="2" Orientation="Horizontal" HorizontalAlignment="Right" Margin="5,5,5,5">
            <Button x:Uid="btnOpen" x:Name="btnOpen" Content="Open" Margin="0,0,10,0" Click="btnOpen_Click" />
            <Button x:Uid="btnCancel" x:Name="btnCancel" Content="Cancel" Click="btnCancel_Click" />
        </StackPanel>

    </Grid>
    
</UserControl>

The above files are used as follows:

PopupWindow popupWindow = new PopupWindow();
            PopupOpenWL popupContent = new PopupOpenWL(popupWindow, m_watchListPresentationModel);
            popupWindow.Window.Header = "Open...";
            popupWindow.Window.Content = popupContent;
            popupWindow.Window.ShowDialog();

Thanks,
Nic

3 Answers, 1 is accepted

Sort by
0
Valentin.Stoychev
Telerik team
answered on 18 Nov 2008, 09:35 PM
Hello Nic,

Yes - this is a bug in the Silverlight framework. When you call TransformToVisual in an element that is in Popup (or RadWindow in our case) this error occurs.

Are you using the latest Silverlight controls? We have just released a pack of fixes ...

Best wishes,
Valentin.Stoychev
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Nic
Top achievements
Rank 1
answered on 19 Nov 2008, 03:15 PM
Hi Valentin,

thank you for your response. I downloaded RadControls_for_Silverlight_2008_3_1117_DEV and pointed my project to the new binaries.
However, I continue to have the problem. Can you please advise on next steps or a workaround?

Thanks,
Nic

0
Hristo Borisov
Telerik team
answered on 24 Nov 2008, 09:17 AM
Hello Nic,

I am sorry for the late reply. I was trying to figure out what the problem is without noticing that you are trying to use the RadWindow control as a UserControl. We are still experiencing problems with the popup control that prevent us for implementing this feature in which the user will be able to use RadWindow as Window in WPF e.g. RadWindow as initial element. We are planning to include this feature for our service pack release which is scheduled for December. At that time you should be able to have a template for adding RadWindow with the menu for existing item. We have already discussed the issue not long ago. Click on the following link for more information: http://www.telerik.com/community/forums/silverlight/window/inherited-radwindow.aspx 

Best wishes,
Hristo Borisov
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
Window
Asked by
Nic
Top achievements
Rank 1
Answers by
Valentin.Stoychev
Telerik team
Nic
Top achievements
Rank 1
Hristo Borisov
Telerik team
Share this question
or