I have a universal usercontrol that has by default in xaml the groupby turned on.
If I want to turn it off dynamically how do I do this in the C# code?
Thanks ahead of time
Jack
Hi Jack,
You may set the GroupByAreaLocation of your XamDataPresenter to "None". This will hide the GroupByArea.
Hope this helps.
Thanks for the quick response.
I want to have a standard usercontrol that enables this feature, hence in the xaml code I enable it.
I want the capability of the user of this control to disable it. Hence, I need a solution that works in the cs code file. I tried the following code, which has correct syntax, but the semantics must be messed up as it does not do anything.
xamDataGrid1.GroupByArea.IsEnabled = false;
I can not in code simple set the GroupByArea to None.
Any more help?
Hello Jack,
The GroupByArea is the previous grouping control used in older versions. According to your description, you are using the new group by area, which is the GroupByAreaMulti. Please try setting the same properties for the GroupByAreaMulti instead of the GroupByArea.
Alex
I still can not get it to work.
Everytime I try ot use the GroupByAreaMulti in my cs code, i get an exception. It is always set to Null.
I turn on the group by feature in the xaml code with
GroupBySummaryDisplayMode
= "SummaryCellsAlwaysBelowDescription"
Now if I set the GroupBySummaryDisplayMode = "None" I do not get it. The problem with this, is I can not do this dynamically in code that uses this usercontrol.
So, how do I set this parameter to None in the C Sharp part of the code?
Thanks again..
I was reading the API's and these are readonly properties :-(
Any other clues?
Thanks !!!! Not sure why it works today, but it does !
Probably the GroupByAreaLocation is not yet initialized. Which event are you using to set it? I tried this and it works correctly :
xamDataGrid1.Loaded += (s, e) =>
{
xamDataGrid1.GroupByAreaLocation = GroupByAreaLocation.None;
//or
xamDataGrid1.GroupByAreaMulti.Visibility = System.Windows.Visibility.Collapsed;
};