Articles in this section
Category / Section

How to make selection of entire row when clicking the particular Row Header

1 min read

The Selection of an entire row by clicking a Row Header is done by setting the AllowSelection enum with Row and Cell. We recommend to set the same in SelectionChanging event to avoid misbehavior after drilling down. The following code explains the same.

 

C#

 

 
public MainWindow()
        {
            try
            {
                ViewModel.ViewModel.ConnectionString = this.GetConnectionString();//"Data Source = F:\\TestDB\\Adventure_Works_Ext.cub; Provider= msolap;";
                InitializeComponent();
                this.olapgrid1.AllowSelection = true;
                this.olapgrid1.Loaded += (s, e) => {
                    this.olapgrid1.InternalGrid.Model.Options.AllowSelection = Syncfusion.Windows.Controls.Grid.GridSelectionFlags.Row | Syncfusion.Windows.Controls.Grid.GridSelectionFlags.Cell;
                    this.olapgrid1.InternalGrid.SelectionChanged += new Syncfusion.Windows.Controls.Grid.GridSelectionChangedEventHandler(InternalGrid_SelectionChanged);
                    this.olapgrid1.InternalGrid.SelectionChanging += new Syncfusion.Windows.Controls.Grid.GridSelectionChangingEventHandler(InternalGrid_SelectionChanging);
                };
            }
            catch (Exception ex)
            {
                this.ShowExceptionMessage(ex); 
            }
        }
 
        void InternalGrid_SelectionChanging(object sender, Syncfusion.Windows.Controls.Grid.GridSelectionChangingEventArgs e)
        {
            this.olapgrid1.InternalGrid.Model.Options.AllowSelection = Syncfusion.Windows.Controls.Grid.GridSelectionFlags.Row | Syncfusion.Windows.Controls.Grid.GridSelectionFlags.Cell ;
        }
 
        void InternalGrid_SelectionChanged(object sender, Syncfusion.Windows.Controls.Grid.GridSelectionChangedEventArgs e)
        {
            var range = e.Range;
        }

 

 

 

Figure: Entire Row is getting selected when clicking the RowHeader “Accessories”

 

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment
Access denied
Access denied