Scrolling problem with GroupDescriptions

3 posts, 0 answers
  1. Geoffrey
    Geoffrey avatar
    48 posts
    Member since:
    Mar 2013

    Posted 11 Apr 2014 Link to this post

    Hello,

    I have a problem with the RadComboBox control. The telerik version that I use is Q1 2014.

    When I group data using ICollectionViewSource, the data are well grouped but some items are not accessible because the scroll go directly to the next group.

    How can I solve that problem ?

    The code of the Group style is defined below:

    01.public FormatBox()
    02.        {
    03.            this.IsEditable = false;
    04.            this.EmptyText = Translator.Translate("Generic_SelectFormat");
    05. 
    06.             
    07.            ScrollViewer.SetCanContentScroll(this, true);
    08. 
    09.            DataTemplate itemTemplate = new DataTemplate();
    10. 
    11.            FrameworkElementFactory stackPanelFactory = new FrameworkElementFactory(typeof(StackPanel));
    12.            stackPanelFactory.SetValue(StackPanel.OrientationProperty, System.Windows.Controls.Orientation.Horizontal);
    13. 
    14.            FrameworkElementFactory textBlock = new FrameworkElementFactory(typeof(TextBlock));
    15.            textBlock.SetBinding(TextBlock.TextProperty, new Binding("Name"));
    16.            stackPanelFactory.AppendChild(textBlock);
    17. 
    18.            textBlock = new FrameworkElementFactory(typeof(TextBlock));
    19.            textBlock.SetValue(TextBlock.TextProperty, " - ");
    20.            stackPanelFactory.AppendChild(textBlock);
    21. 
    22.            textBlock = new FrameworkElementFactory(typeof(TextBlock));
    23.            textBlock.SetBinding(TextBlock.TextProperty, new Binding("Description"));
    24.            stackPanelFactory.AppendChild(textBlock);
    25. 
    26.            itemTemplate.VisualTree = stackPanelFactory;
    27. 
    28.            this.ItemTemplate = itemTemplate;
    29. 
    30. 
    31.            GroupStyle style = new GroupStyle();
    32.            style.HidesIfEmpty = true;
    33. 
    34.            DataTemplate headerTemplate = new DataTemplate();
    35. 
    36.            textBlock = new FrameworkElementFactory(typeof(TextBlock));
    37.            textBlock.SetBinding(TextBlock.TextProperty, new Binding("Name") { Converter = new FormatBoxBooleanToTranslationConverter() });
    38.            textBlock.SetValue(TextBlock.FontWeightProperty, FontWeights.Bold);
    39.            textBlock.SetValue(FrameworkElement.MarginProperty, new Thickness(5, 0, 5, 0));
    40.            textBlock.SetValue(FrameworkElement.VerticalAlignmentProperty, VerticalAlignment.Center);
    41.            style.HeaderTemplate = headerTemplate;
    42. 
    43.            FrameworkElementFactory border = new FrameworkElementFactory(typeof(Border));
    44.            border.SetValue(Border.BackgroundProperty, new SolidColorBrush(System.Windows.Media.Color.FromArgb(255, 227, 239, 255)));
    45.            border.SetValue(FrameworkElement.HeightProperty, 20d);
    46. 
    47.            border.AppendChild(textBlock);
    48. 
    49.            headerTemplate.VisualTree = border;
    50. 
    51.            this.GroupStyle.Add(style);
    52.        }

    Thanks in advance, this problem is critical for us.
    Geofrrey
  2. Rosen Vladimirov
    Admin
    Rosen Vladimirov avatar
    640 posts

    Posted 15 Apr 2014 Link to this post

    Hi Geoffrey,

    The incorrect scrolling is caused by the framework itself - when you are using CollectionViewSource, there's no virtualization and several issues like the one you've found, will occur. This issue had been resolved in .Net 4.5 - you just have to make your project for this version of the framework and set VirtualizingPanel.IsVirtualizingWhenGrouping property of RadComboBox:
    <telerik:RadComboBox VirtualizingPanel.IsVirtualizingWhenGrouping="True">

    Hope this helps. Feel free to contact us in case you have any problems or concerns.

    Regards,
    Rosen Vladimirov
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  3. UI for WPF is Visual Studio 2017 Ready
  4. Geoffrey
    Geoffrey avatar
    48 posts
    Member since:
    Mar 2013

    Posted 15 Apr 2014 in reply to Rosen Vladimirov Link to this post

    It works fine.

    Thanks for your answer.

    Regards,
    Geoffrey
Back to Top