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

RadComboBox inside DropDownContent error

2 Answers 77 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Marjeta Segrec
Top achievements
Rank 1
Marjeta Segrec asked on 21 Apr 2010, 08:39 PM
Hello.

Controls info: Telerik controls version for Silverlight 4 2010.1.0416 in VS 2010.

If put RadComboBox inside RadRibbonDropDownButton.DropDownContent and after click/select in ComboBoxItem application crash - but if put MS ComboBox or C1.ComboBox inside RadRibbonDropDownButton.DropDownContent  application work normal.

error :
Microsoft JScript runtime error: Unhandled Error in Silverlight Application
Code: 4004   
Category: ManagedRuntimeError      
Message: System.ArgumentException: Value does not fall within the expected range.
   v MS.Internal.XcpImports.MethodEx(IntPtr ptr, String name, CValue[] cvData)
   v MS.Internal.XcpImports.MethodPack(IntPtr objectPtr, String methodName, Object[] rawData)
   v MS.Internal.XcpImports.UIElement_TransformToVisual(UIElement element, UIElement visual)
   v System.Windows.UIElement.TransformToVisual(UIElement visual)
   v Telerik.Windows.Controls.RadComboBoxItem.BringIntoView()
   v Telerik.Windows.Controls.RadComboBox.ScrollIntoView(Object item)
   v Telerik.Windows.Controls.RadComboBox.NavigateToItem(Object item)
   v Telerik.Windows.Controls.RadComboBox.OnSelectionChanged(SelectionChangedEventArgs e)
   v Telerik.Windows.Controls.RadComboBox.SelectItemDelayedSelectionChanged(Object item)
   v Telerik.Windows.Controls.RadComboBox.NotifyComboBoxItemMouseUp(RadComboBoxItem comboBoxItem)
   v Telerik.Windows.Controls.RadComboBoxItem.OnMouseLeftButtonUp(MouseButtonEventArgs e)
   v System.Windows.Controls.Control.OnMouseLeftButtonUp(Control ctrl, EventArgs e)
   v MS.Internal.JoltHelper.FireEvent(IntPtr unmanagedObj, IntPtr unmanagedObjArgs, Int32 argsTypeIndex, String eventName)

I am prepared the simple sample for you where can you reproduce that:

<UserControl x:Class="SLRadComboBox.MainPage" 
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
    mc:Ignorable="d" 
    xmlns:telerikRibbon="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.RibbonBar"   
    d:DesignHeight="300" d:DesignWidth="400">  
 
    <Grid x:Name="LayoutRoot" Background="White">  
        <Grid.RowDefinitions > 
            <RowDefinition Height="Auto"/>  
            <RowDefinition Height="*"/>  
        </Grid.RowDefinitions> 
 
        <Border Margin="30" Padding="10" CornerRadius="6" BorderThickness="1" BorderBrush="Gray" Background="Cyan" > 
            <StackPanel Orientation="Horizontal"  HorizontalAlignment="Center"  > 
                <telerikRibbon:RadRibbonDropDownButton x:Name="DropDownButton1" Margin="4" Text="DropDown With RadRibbonComboBox" > 
                </telerikRibbon:RadRibbonDropDownButton> 
                <telerikRibbon:RadRibbonDropDownButton x:Name="DropDownButton2" Margin="4" Text="DropDown With MS ComboBox" > 
                </telerikRibbon:RadRibbonDropDownButton> 
            </StackPanel> 
        </Border> 
    </Grid> 
</UserControl> 
 


 
 
Option Strict On
#Region " Imports ----------------------------------------------------------------------- "  
Imports System.Collections  
Imports System.Collections.Generic  
Imports System.Collections.ObjectModel  
Imports System.Collections.Specialized  
Imports System.Linq  
Imports System.Windows  
Imports System.Windows.Data  
Imports System.Windows.Media  
Imports System.Windows.Resources  
Imports Telerik.Windows.Controls
#End Region ' Imports  
 
Partial Public Class MainPage  
    Inherits UserControl  
 
    Public Sub New()  
        InitializeComponent()  
        '  
        If System.ComponentModel.DesignerProperties.GetIsInDesignMode(MeThen 
            Return 
        End If ' System.ComponentModel.DesignerProperties.GetIsInDesignMode(Me)  
        '  
        Me.BuildDropDownContent()  
    End Sub 
 
    Private Sub BuildDropDownContent()  
        Dim sp1 As New StackPanel With {.Orientation = Orientation.Vertical}  
        Dim sp2 As New StackPanel With {.Orientation = Orientation.Vertical}  
        Dim source() As String = New String() { _  
            "RadContextMenu""StackPanel""RadRibbonComboBox""UserControl"}  
 
        For a As Integer = 1 To 3  
            Dim cmb1 As New RadRibbonComboBox With { _  
                .ItemsSource = source, .Margin = New Thickness(2), .Width = 140}  
            sp1.Children.Add(cmb1)  
            '  
            Dim cmb2 As New ComboBox With { _  
                .ItemsSource = source, .Margin = New Thickness(2), .Width = 140}  
            sp2.Children.Add(cmb2)  
        Next 
        '  
        Me.DropDownButton1.DropDownContent = sp1  
        Me.DropDownButton2.DropDownContent = sp2  
 
    End Sub ' BuildDropDownContent  
 
End Class ' MainPage 


Thanks for your answer.
Regards,

2 Answers, 1 is accepted

Sort by
0
Valeri Hristov
Telerik team
answered on 26 Apr 2010, 02:39 PM
Hi Marjeta,

Thank you for the sample code, it helped to reproduce the problem. We will need some time to find what's the cause, I will write back here again when I have more information.

Best wishes,
Valeri Hristov
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Valeri Hristov
Telerik team
answered on 26 Apr 2010, 04:31 PM
Hi Marjeta,

This problem is caused by the RadRibbonDropDownButton's autoclose behavior - it listens for a SelectionChanged event and when such is raised, it closes its dropdown. In your case, when RadComboBox changes its selection, the DropDownButton closes its dropdown, but RadComboBox tries to scroll itself, so the newly selected item is visible and fails with the exception you are seeing.

To workaround the problem we would recommend setting the KeepOpen property on RadRibbonDropDownButton to true:
<ribbon:RadRibbonDropDownButton KeepOpen="True" ...

Kind regards,
Valeri Hristov
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Tags
ComboBox
Asked by
Marjeta Segrec
Top achievements
Rank 1
Answers by
Valeri Hristov
Telerik team
Share this question
or