RadGridView Flickers when ColumnWidth is set to Fill *

2 posts, 0 answers
  1. Sreenivasan
    Sreenivasan avatar
    1 posts
    Member since:
    Jan 2016

    Posted 14 Feb Link to this post

    Hi,

     

     I am using RadDropDownButton and RadDropDownContent has a grid with a message and RadGridView.  RadGridview has a single column which has data template that render checkboxes for the elements in list to which this column is bound to.  I get an additional space / extra column at the end of the radgridview.  When I try to remove this column by setting width of the only property to * or set columnwidth of radgridview to * as suggested in the forums,  the grid just keeps on flickering.  I seem to be missing something very simple.  Any help on removing this extra space is appreciated..

     

    XAML -

     

    <Window x:Class="MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
        Title="MainWindow" Height="350" Width="525">
        
        <telerik:RadDropDownButton DropDownIndicatorVisibility="Collapsed" 
                                                   Height="25"
                                                   Width="25"
                                                   ToolTip="Configure Column Set"
                                                   Padding="0"  
                                                   HorizontalContentAlignment="Left" 
                                                   Margin="0,0,6,0"
                                                   IsOpen="{Binding IsDropDownContentOpen, Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
                                                   Command="{Binding ConfigureColumnSetCommand}">

           
            <telerik:RadDropDownButton.DropDownContent>

                <Grid Margin="10">

                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="Auto" />
                    </Grid.RowDefinitions>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition />
                    </Grid.ColumnDefinitions>

                    <!-- Configure Column Set Text-->
                    <TextBlock x:Name="txtConfigColumnSetMsg"
                                                   Text="Select columns to be visible in grid" />


                    <!-- Configure Column Set Grid -->
                    <telerik:RadGridView x:Name="grdConfigureColumnSet"
                                                             ItemsSource="{Binding ColumnSet,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
                                                             Grid.Row="1"
                                                             ShowGroupPanel="False"
                                                             ShowInsertRow="False"
                                                             CanUserDeleteRows="False"
                                                             CanUserFreezeColumns="False"
                                                             RowIndicatorVisibility="Collapsed"
                                                             AutoGenerateColumns="False"
                                                             SelectionMode="Single"
                                                             AutomationProperties.AutomationId="grdConfigureColumnSet"
                                                             ScrollViewer.HorizontalScrollBarVisibility="Hidden"
                                                             ScrollViewer.IsDeferredScrollingEnabled="False"
                                                             ScrollViewer.CanContentScroll="False"
                                                             CanUserReorderColumns="False"
                                                             CanUserSortColumns="False"
                                                             CanUserSortGroups="False"
                                                             IsFilteringAllowed="False" >

                        <telerik:RadGridView.Columns>

                            <telerik:GridViewDataColumn  
                                                         IsReadOnly="True"
                                                         DataMemberBinding="{Binding IsSelected,UpdateSourceTrigger=PropertyChanged, Mode=TwoWay}"
                                                         Width="*">

                               
                                <telerik:GridViewDataColumn.CellTemplate>
                                    <DataTemplate>
                                        <CheckBox IsChecked="{Binding IsSelected,Mode=TwoWay,UpdateSourceTrigger= PropertyChanged}"
                                                                      Content="{Binding Name}" />
                                    </DataTemplate>
                                </telerik:GridViewDataColumn.CellTemplate>
                            </telerik:GridViewDataColumn>
                        </telerik:RadGridView.Columns>
                    </telerik:RadGridView>

                   
                </Grid>
            </telerik:RadDropDownButton.DropDownContent>

        </telerik:RadDropDownButton>
    </Window>

     

    Code behind -

     Class MainWindow

        Public Sub New()

            ' This call is required by the designer.
            InitializeComponent()

            ' Add any initialization after the InitializeComponent() call.
            Me.DataContext = New MyViewModel
        End Sub

    End Class

    Public Class MyViewModel

        Public Sub New()

            ColumnSet.Add(New ColumnItem With {.Name = "Col1", .IsSelected = False})


        End Sub

        Public Property ColumnSet As New List(Of ColumnItem)

    End Class

    Public Class ColumnItem

        Public Property Name As String

        Public Property IsSelected As Boolean

    End Class

     

     

     

    Regards,

    Sreeni.

  2. Stefan X1
    Admin
    Stefan X1 avatar
    521 posts

    Posted 17 Feb Link to this post

    Hi Sreeni,

    Thanks for the provided code demonstrating the usage of the control.

    After reviewing it, it seems that with the current implementation, RadGridView is measured with infinity. In order to avoid the flickering in this scenario, you can try setting the RowIndicatorVisibility of RadGridView to "Hidden" instead of "Collapsed", or simply set a fixed value for the Width property of the control.

    All the best,
    Stefan X1
    Telerik
    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 Feedback Portal and vote to affect the priority of the items
  3. UI for WPF is Visual Studio 2017 Ready
Back to Top