GridGroupDropArea - Changing the font

Good day,

I need to implement the feature where the user can change the font size of the GridGroupingDropArea, but not as an .
Everything works fine except for the fact that i cannot get the GridGroupDropArea font size to change.

In the below screenshot I am using font size 20 to highlight where changes are not applied. And as you can see the Drop area is still using the default font size

The following is the code i am using currently:


From the forum I have seen a solution by using the PrepareViewStyleEvent (as below) and it does work.



However I don't want some font size code in one method and others in an event.
I'd like to have them together in one location. 

So is there some code that i can set the GridGroupDropArea font size in the same location as the other font code?




5 Replies

AR Arulpriya Ramalingam Syncfusion Team January 17, 2018 08:37 AM UTC

Hi James,  
  
Thanks for contacting Syncfusion support.  
  
In order to set the Font family name and size for the GroupDropArea of the GridGroupingControl, the Font property ofGridGroupDropArea can be used. Please make use of the below code and sample,  
  
Code example  
  
//To show the GroupDropArea  
this.gridGroupingControl1.ShowGroupDropArea = true;  
//To set the Font Style of GroupDropArea  
this.gridGroupingControl1.GridGroupDropArea.Font = new Font("Segoe UI", 13f);  
  
  
  
Screenshot  
  
   
  
  
Regards,  
Arulpriya  



JR James Roodt January 17, 2018 09:06 AM UTC

Hi Arulpriya,

I did saw that field and originally tried to use it but it had no effect.
I assume that some of my settings cause it not to be used.







AR Arulpriya Ramalingam Syncfusion Team January 18, 2018 01:30 PM UTC

Hi James, 
 
Thanks for your update. 
 
We have analyzed your code part at our end. The Font for the GroupDropArea will be set from the GdipFont of the GroupDropArea when the HieraricalGroupDropArea is enabled. Moreover, the GdipFont of GridFontInfo will not be updated when the Font of the GroupDropArea is set. In order to set the font style for the GroupDropArea, the Font property of the GridStyleInfo can be used. We have created a simple sample as per your requirement. Please make use of the below code and sample, 
 
Code example 
 
public void SetGroupDropArea(GridGroupingControl grid, bool visible) 
{ 
    //To show the GroupDropArea 
    grid.ShowGroupDropArea = visible; 
    //To set the Font Style of GroupDropArea 
    grid.TableModel.Table.TopLevelGroup.ParentTableDescriptor.Name = "Parent Table"; 
    grid.HierarchicalGroupDropArea = true; 
    //To set the Font style for GroupDropArea 
    grid.GridGroupDropArea.Model.BaseStylesMap.Standard.StyleInfo.Font = new GridFontInfo(new Font("Segeo UI", 13f)); 
    grid.GridGroupDropArea.AllowRemove = true; 
    grid.GridGroupDropArea.TreeLinePlacement = TreeLinePlacement.Bottom; 
    grid.GridGroupDropArea.DynamicResizing = true; 
    grid.GridGroupDropArea.TreeLineColor = Color.Red; 
} 
 
 
Regards, 
Arulpriya 



JR James Roodt January 23, 2018 12:30 PM UTC

Hi Arulpriya,

This is perfect. Thank you very much!

Regards,
James


AR Arulpriya Ramalingam Syncfusion Team January 24, 2018 06:55 AM UTC

Hi James, 
 
Thanks for your update. 

We are glad to hear that the provided solution was resolved your scenario.   
 
Please let us know, if you have any other queries. 
 
Regards, 
Arulpriya 


Loader.
Up arrow icon