Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
295
GroupByArea - Adjusting height
posted

Hello,

I have a requirement to decrease height of GroupByArea.of a XamDataGrid.

Could you please provide a sample code for how to do that,I saw several post about customizing GroupByArea,but it didn't helped.

 

TIA

Vivek

 

 

 

 

 

 

  • 54937
    Offline posted

    The best way to figure out what you need to change would be to get a tool like Snoop that let's you inspect with and manipulate the visual tree of elements. Then run a project that has the elements you want to manipulate/change and use Snoop to inspect that application. Then you can hold Ctrl+Shift while moving the mouse over the window and there is a red highlight around the element it found.

    In this case when you move over the group by area you will see that there is some space around the prompts (or fields if you have grouped by one or more fields). If you then go to Snoop's tree and start navigating up the parent nodes you will see that the difference in size occurs between the Grid and the CardPanel. You then have some idea of what elements might need to be adjusted. At that point you can look at things like the values set on RowDefinitions, the Margin/Padding/Height/Width/etc set on these elements, etc. In this case you will find that there is a Margin on the CardPanel. Snoop lets you change the values so you can try changing the Margin from 0,5,0,5 to 0. That takes the height of the group by area down from about 54 to about 44 pixels.

    Now if you still want to reduce it furthern then you need to inspect other elements and change some settings. For example you might find that the tallest element now is the prompt1 ContentControl because it has a FontSize of 24. Reducing that reduces the height of the group by area further.

    So now that you know what you have to change you need to figure out what element's template needs to change. For that you can look at the element. Since this isn't a datapresenter element's it's not likely that you need to change it's style. However if you look at the TemplatedParent you will see that it is part of the GroupByAreaMulti's template. So basically you need to take a copy of the Style for that element and modify the ControlTemplate as you did through Snoop and put that modified Style (with the modified template) in the Resources of the DataPresenter. (Note in theory you can put it higher up the element chain - e.g. in the window's resources or in the app's resources - but if you set the Theme property this won't be used since that will provide a local style.) We ship the default xaml for the controls in the DefaultStyles directory (e.g. C:\Program Files (x86)\Infragistics\NetAdvantage 2010.3\WPF\DefaultStyles\DataPresenter).

  • 295
    posted

    Hello Team,

     

    Can somebody help me?

     

    Thanks

     

    Vivek