We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

TreeView in a GGC cell

Hi i am looking for solution to have a treeView in a grid cell. For Ragistering a control to the grid cell. what are the procedure to do. i have seen your example but still not have cleared my daubt about it. so can u please help me...... Thanks Vihar....

14 Replies

AD Administrator Syncfusion Team December 3, 2005 09:43 AM UTC

Do you want a grid with a single TreeView cell or a grid with many TreeView cells? If you want a single Tree cell, then create an instance of your TreeView control. Then subscribe to the QueryCellStyleInfo event in the grid. If e.TableCellIdentity points to the cell where you want to see this treeview, then set e.Style.Control = yourInstanceOfTreeView and set e.Style.CellType = "Control". If you want manu treeview cells, then your woul dhave to derive a custom cell type like the ones in \3.3.0.0\Windows\Grid.Windows\Samples\CellTypes\CalendarCells. Then to use your custom cell type in a GGC, you need to register this celltype with the grid as shown in this sample. \3.3.0.0\Windows\Grid.Windows\Samples\Grouping\CustomCellTypes


VI vihar December 6, 2005 10:13 AM UTC

>Do you want a grid with a single TreeView cell or a grid with many TreeView cells? > >If you want a single Tree cell, then create an instance of your TreeView control. Then subscribe to the QueryCellStyleInfo event in the grid. If e.TableCellIdentity points to the cell where you want to see this treeview, then set e.Style.Control = yourInstanceOfTreeView and set e.Style.CellType = "Control". > >If you want manu treeview cells, then your woul dhave to derive a custom cell type like the ones in \3.3.0.0\Windows\Grid.Windows\Samples\CellTypes\CalendarCells. Then to use your custom cell type in a GGC, you need to register this celltype with the grid as shown in this sample. \3.3.0.0\Windows\Grid.Windows\Samples\Grouping\CustomCellTypes I do have a coloumn in my GGC grid name Plant level.for that coloumn in each cell i want to have treeview which will display plant levels ...


AD Administrator Syncfusion Team December 6, 2005 11:33 AM UTC

Then you will have to derive a custom celltype that uses a Treeview Control. Take a look at the \Windows\Grid.Windows\Samples\CellTypes\CalendarCells samples. It derives a custom celltype that uses a MonthCalendar Control. You can try to do something similar for a TreeControl.


VI vihar December 6, 2005 01:40 PM UTC

>Then you will have to derive a custom celltype that uses a Treeview Control. Take a look at the \Windows\Grid.Windows\Samples\CellTypes\CalendarCells samples. It derives a custom celltype that uses a MonthCalendar Control. You can try to do something similar for a TreeControl. Thanks Clay Burch Now I got the control in the cell.. But now the problem is it has also a child level grids so in that i am getting the problem while opening the child levels. so man , how to ragister a control only with parent grid.. that it will not create a problem with child grid..... and thanks for replying last mess ...


AD Administrator Syncfusion Team December 6, 2005 02:51 PM UTC

I am not sure I understand. You have registered your own CellType, correct? If so, you can try to use this CellType like any other CellType. If you are using it in QuerycellStyleInfo, then you would have to check to make sure you are in the proper table (You could use e.TableCellIdentity.Table.TableDescriptor.Name to see the table being used.) If you are just explicitly setting it as a property using TableDescriptor.Appearance.AnyRecordFieldCell.CellType, then it should only appear in the table whose TableDescriptor you are accessing. Since youare trying to use this is multiple cells, then you must derive your own cell type, and will not be able to just use the "Control" CellType to do this.


VI vihar December 7, 2005 08:51 AM UTC

Hai thanks man its work fine.. Thanks Fore your Quick Reply.... >I am not sure I understand. You have registered your own CellType, correct? > >If so, you can try to use this CellType like any other CellType. > >If you are using it in QuerycellStyleInfo, then you would have to check to make sure you are in the proper table (You could use e.TableCellIdentity.Table.TableDescriptor.Name to see the table being used.) > >If you are just explicitly setting it as a property using TableDescriptor.Appearance.AnyRecordFieldCell.CellType, then it should only appear in the table whose TableDescriptor you are accessing. > >Since youare trying to use this is multiple cells, then you must derive your own cell type, and will not be able to just use the "Control" CellType to do this.


VI vihar December 7, 2005 09:02 AM UTC

man a small problem is there . If i am changing a size of that perticular coloumn in which my control is ther then how can i change the size of my control accordingly to that coloumn size.. ....? > >Hai thanks man its work fine.. > >Thanks Fore your Quick Reply.... > > > >>I am not sure I understand. You have registered your own CellType, correct? >> >>If so, you can try to use this CellType like any other CellType. >> >>If you are using it in QuerycellStyleInfo, then you would have to check to make sure you are in the proper table (You could use e.TableCellIdentity.Table.TableDescriptor.Name to see the table being used.) >> >>If you are just explicitly setting it as a property using TableDescriptor.Appearance.AnyRecordFieldCell.CellType, then it should only appear in the table whose TableDescriptor you are accessing. >> >>Since youare trying to use this is multiple cells, then you must derive your own cell type, and will not be able to just use the "Control" CellType to do this.


AD Administrator Syncfusion Team December 7, 2005 11:42 AM UTC

I am not sure how you are getting your control into the cells. But if you are using the CalendarCells technique, then that code uses the renderer.OnDraw override to set the size of the control. And this code works as is in the CalendarCells sample to keep the control size proper as you change the column width. If it does not work in your code, then in your Ondraw method, try explicilty setting the Size property of your controls to the clientrectangle.Size passed in.


VI vihar December 8, 2005 01:49 PM UTC

Thanks Clay Burch, I am able to get the user control but still there are few issues when displaying the values. The problem starts after registering the control. Initially when the grid is loaded, the Cell Type of the particular Column is simple DropDown which we then change, to our user control in QueryCellStyleInfo. The problem which we are facing now is that, we have name as display memeber & ID as value member, but once the grid is loaded, it shows me the ID instead of name. I would appreciate if, you could provide us with a solution to this issue. Regards, Vihar


AD Administrator Syncfusion Team December 8, 2005 01:56 PM UTC

If you want to get the DisplayMember form a conbobox cell, then you use the FormattedText property on the style instead of the Cellvalue or Text property. So, try using e.Style.FormattedText to see if that gives you what you want.


VI vihar December 16, 2005 06:29 AM UTC

Thanks Clay Burch, Can u please give me some ideas for following doued. Can i able to define some properties like Valuemember , and displaymember which i can used for displaying data.. ? >If you want to get the DisplayMember form a conbobox cell, then you use the FormattedText property on the style instead of the Cellvalue or Text property. So, try using e.Style.FormattedText to see if that gives you what you want.


ST stanleyj Syncfusion Team December 16, 2005 10:12 AM UTC

Hi Vihar, Here is a sample to show the use of DisplayMember and ValueMember properties for a ComboBox. See if that helps. Regards, Stanley


VI vihar January 3, 2006 10:43 AM UTC

Hi Stanley, If i Want to make the cell editable in which i ragistered my Control. How can i do it? Because i want to write somthing in that cell and then search that from the ragistered Tree. so How Can i make that cell editable.. Infact, By Using QueryCellStyleInfo i am makeing the AllowEnter prperty true even though on clicking the cell cursor is not coming.So i can not write any thing... So Can you please help me in this problem .... >Hi Vihar, > >Here is a sample to show the use of DisplayMember and ValueMember properties for a ComboBox. See if that helps. > >Regards, >Stanley


ST stanleyj Syncfusion Team January 3, 2006 04:10 PM UTC

Hi Vihar, If you following CalendarCells samples, editing must be possible there. Deriving GridGenericControlCellModel and GridGenericControlCellRenderer is useful if support for embedding any custom .NET control inside a cell is needed. Therefore using this will help in editing since the control is editable. So, the TreeView that has editable nodes has to be editable. Regards, Stanley

Loader.
Live Chat Icon For mobile
Up arrow icon