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

Grid View Command of ComboBox rows trigger on scrolling

1 Answer 110 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Bernard
Top achievements
Rank 1
Bernard asked on 03 Mar 2017, 07:54 PM

The following is the code snippet from my code.  I have the command CheckTypeCommand defined in my Model. There are over 100,000 items in my collection and the number of columns is 50 odd. If I scroll up or down of this grid the command of this check box for every row that is render is getting executed. I want the command only to execute on UI trigger that is when I change the Check Type in the combobox. Can you please let me know what is I am missing here. If I disable Virtualization then the performance goes for a spin.

  <telerik:RadGridView x:Name="radGridView"  ItemsSource="{Binding myList}"  AutoGenerateColumns="False"
                             Grid.Row="3" Grid.ColumnSpan="2" FontSize="11"
                             SelectionMode="Single"  SelectionUnit="Mixed"
                             ClipboardCopyMode="Default"
                                 ActionOnLostFocus="CommitEdit" ScrollMode="RealTime" ElementExporting="radGridView_ElementExporting"
                                 SelectedItem="{Binding  Data.GridSelectedRow, Source={StaticResource proxy} , Mode=TwoWay}"  IsSynchronizedWithCurrentItem="False"
                                 ShowColumnSortIndexes="True" RowIndicatorVisibility="Collapsed" behaviours:ContextMenuBehavior.ContextMenu="{Binding ElementName=GridContextMenu}" FrozenColumnCount="3" >
                                  
                <telerik:RadContextMenu.ContextMenu>
                    <telerik:RadContextMenu x:Name="GridContextMenu" ItemsSource="{Binding ContextMenu}" ItemContainerStyle="{StaticResource MenuItemContainer}"  >
                    </telerik:RadContextMenu>
                 <telerik:GridViewDataColumn x:Name="checktypecombo" DataMemberBinding="{Binding CheckType, Mode=TwoWay}" 
                                UniqueName="CheckType" IsReadOnlyBinding="{Binding IsReadOnly}"    IsReadOnly="True"
                                                SortMemberPath="CheckType"   EditTriggers="CellClick"   IsFilterable="False" IsGroupable="False"
                                                IsSortable="False" Width="75">
                        <telerik:GridViewDataColumn.Header>
                            <TextBlock Text="Check Type" TextWrapping="Wrap" Style="{StaticResource TextBlockWhite}" />
                        </telerik:GridViewDataColumn.Header>
                        <telerik:GridViewColumn.CellTemplate>
                            <DataTemplate>
                                <telerik:RadComboBox Command="{Binding CheckTypeChanged}" 
                                                    SelectedValue="{Binding CheckType, Mode=OneWay}" SelectedValuePath="Tag"
                                                     IsEditable="False">
                                    <telerik:RadComboBoxItem Tag="C1" Content="Checktype1"/>
                                    <telerik:RadComboBoxItem Tag="C2" Content="C2"/>                    
                                </telerik:RadComboBox>
                                   </DataTemplate>
                        </telerik:GridViewColumn.CellTemplate>
                    </telerik:GridViewDataColumn>   
                         
</telerik:RadGridView

  <telerik:RadGridView x:Name="radGridView"  ItemsSource="{Binding myList}"  AutoGenerateColumns="False"
                             Grid.Row="3" Grid.ColumnSpan="2" FontSize="11" EnableColumnVirtualization="False" 
                             SelectionMode="Single"  SelectionUnit="Mixed"
                             ClipboardCopyMode="Default" 
                                 ActionOnLostFocus="CommitEdit" ScrollMode="RealTime" ElementExporting="radGridView_ElementExporting" 
                                 SelectedItem="{Binding  Data.GridSelectedRow, Source={StaticResource proxy} , Mode=TwoWay}"  IsSynchronizedWithCurrentItem="False"
                                 ShowColumnSortIndexes="True" RowIndicatorVisibility="Collapsed" behaviours:ContextMenuBehavior.ContextMenu="{Binding ElementName=GridContextMenu}" FrozenColumnCount="3" >
 
                <telerik:RadContextMenu.ContextMenu>
                    <telerik:RadContextMenu x:Name="GridContextMenu" ItemsSource="{Binding ContextMenu}" ItemContainerStyle="{StaticResource MenuItemContainer}"  >
                    </telerik:RadContextMenu>
    <telerik:GridViewDataColumn x:Name="checktypecombo" DataMemberBinding="{Binding CheckType, Mode=TwoWay}"  
UniqueName="CheckType" IsReadOnlyBinding="{Binding IsReadOnly}"    IsReadOnly="True" 
                                                SortMemberPath="CheckType"   EditTriggers="CellClick"   IsFilterable="False" IsGroupable="False"
                                                IsSortable="False" Width="75">
                        <telerik:GridViewDataColumn.Header>
                            <TextBlock Text="Check Type" TextWrapping="Wrap" Style="{StaticResource TextBlockWhite}" />
                        </telerik:GridViewDataColumn.Header>
                        <telerik:GridViewColumn.CellTemplate>
                            <DataTemplate>
                                <telerik:RadComboBox Command="{Binding CheckTypeChanged}"  
                                                    SelectedValue="{Binding CheckType, Mode=OneWay}" SelectedValuePath="Tag" 
                                                     IsEditable="False">
                                    <telerik:RadComboBoxItem Tag="C1" Content="Checktype1"/>
                                    <telerik:RadComboBoxItem Tag="C2" Content="C2"/>  
</telerik:RadComboBox>
      </DataTemplate>
                        </telerik:GridViewColumn.CellTemplate>
                    </telerik:GridViewDataColumn>  

</telerik:RadGridView

1 Answer, 1 is accepted

Sort by
0
Bernard
Top achievements
Rank 1
answered on 03 Mar 2017, 07:56 PM
The version of my telerik.Gridview.dll is 2014.1.331.40
Tags
GridView
Asked by
Bernard
Top achievements
Rank 1
Answers by
Bernard
Top achievements
Rank 1
Share this question
or