How to use ColumnChooser in UserControl?

Hello,


I have a user control. This user control has sfDataGrid inside. I'm using the ColumnChooser class to make the columns hideable. Owner property takes only one window.


How can you define in user control?


3 Replies 1 reply marked as answer

AR Arulpriya Ramalingam Syncfusion Team November 17, 2021 07:37 PM UTC

Hi Özgür, 
 
Thank you for your interest in Syncfusion products. 
 
The window of the usercontrol can be retrieved using GetWindow() and assigned it to the Owner property of the chooserWindow. Please make use of the below code example and sample. 
 
Example code 
 
chooserWindow = new ColumnChooser(this.dataGrid) { Width = 300, Height = 500 }; 
this.dataGrid.GridColumnDragDropController = new GridColumnChooserController(this.dataGrid, chooserWindow); 
chooserWindow.Show(); 
//To get window of the user control. 
Window window = Window.GetWindow(this); 
chooserWindow.Owner = window; 
 
 
Please get back to us if you need any further assistance. 
 
Regards, 
Arulpriya Ramalingam 


Marked as answer

ÖZ Özgür November 18, 2021 06:21 AM UTC

Thank you for answering. It worked for me.



AR Arulpriya Ramalingam Syncfusion Team November 18, 2021 01:48 PM UTC

Hi Özgür, 
 
Thank you for the update. 
 
We are glad that the provided solution helped you to achieve your requirement. Please get back to us if you need any other queries, we are happy to assist you. 
 
Arulpriya Ramalingam 


Loader.
Up arrow icon