Can't change RadComboBox's ItemsPanel

3 posts, 0 answers
  1. khiem nv
    khiem nv avatar
    8 posts
    Member since:
    Oct 2009

    Posted 23 Jun 2010 Link to this post

    In my project, I want to change RadComboBox's ItemsPanel : Combo show ToolTip for String value too long and dropdownlist's width isn't spanned when value is too long. With short combos, when opened,  dropdownlist's width is 300 pixel. With combos that longer than 300 pixel, I want dropdownlist's width = combo's width. To do that, I used ItemTemplate for ToolTip and ItemsPanel for dropdownlist's width.
    This work when combo's width is small but when combo's width too long, only dropdownlist's width is spanned, Yellow area show which item is selected not spanned. I implemented SizeChanged event, clear old ItemsPanel, pass new ItemsPanel for combo

    Dim s As String = "<ItemsPanelTemplate xmlns=""http://schemas.microsoft.com/winfx/2006/xaml/presentation""><VirtualizingStackPanel HorizontalAlignment=""Left"" Width=""" + newWidth.ToString + """/></ItemsPanelTemplate>" 
            Dim oItemsPanelTemplate As ItemsPanelTemplate = XamlReader.Load(s) 
            If cbo.ItemsPanel IsNot Nothing Then 
                cbo.ItemsPanel = Nothing 
            End If 
            cbo.ItemsPanel = oItemsPanelTemplate 
             
            Me.ApplyTemplate() 
     

    Any way to fix this error?
  2. hvduc
    hvduc avatar
    33 posts
    Member since:
    Jun 2010

    Posted 24 Jun 2010 Link to this post

    I found out If I implement VirtualizingStackPanel's SizeChanged event, I can change width of selection area. But it only works when I add event handler on Xaml. when use XamlReader.Load , it raise error: "System.Windows.Markup.XamlParseException: XamlReader.Load() does not accept event handlers" . Any idea to add event handler when use XamlReader.Load?
  3. DevCraft banner
  4. Konstantina
    Admin
    Konstantina avatar
    2332 posts

    Posted 25 Jun 2010 Link to this post

    Hello,

    Thank you for your interest in our controls.

    The ItemsPanel of the ComboBox can be changed only before the ComboBox is loaded. As for the Width of the ComboBox and the DropDown: the ComboBox to expand according to the width of the items you will need to remove the fixed Width. The width of the DropDown is known after the DropDown is open. So to customize it and make it the same as the ComboBox's you will have to edit the Template of the ComboBox.
    About the XamlReader.Load() method - it does not have an overload for event handlers. For more information you can refer to these help articles:

    If you have any other questions please let us know.

    Greetings,
    Konstantina
    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
Back to Top