I have a particular field set as a "grouped" column by default for a grid. It specifies a particular field to use and of course, uses the value from that field in the header label text. Can I add a converter somehow to append to that label text?
I'm adding the grouped field by doing this:
<
igDP:FieldLayout.SortedFields>
="BusinessCategory" />
>
Hello,
I am just checking if my last reply was helpful for you.
If you require any further assistance please do not hesitate to ask.
Sincerely,
Krasimir
Developer Support Engineer
Infragistics
www.infragistics.com/support
I have been looking into the scenario that you described and another think I can suggest is handling XamDataGrid’s Loaded event and add the following code in its event handler:
GridViewPanelFlat gvpf =
Utilities.GetDescendantFromType(
sender as DependencyObject,
typeof(GridViewPanelFlat),
false) as GridViewPanelFlat;
if (gvpf != null && gvpf.ChildElements != null)
{
foreach (var record in gvpf.ChildElements)
if (record is GroupByRecordPresenter)
TextBlock txt =
record as DependencyObject,
typeof(TextBlock),
false) as TextBlock;
txt.Text = txt.Text + " + Some other text";
}
This will add additional text to the GroupByRecordPresenters that are already loaded in the XamDataGrid. Also you can handle the Gouped event of the XamDataGrid and add the same code snippet in the hadler. Since the GroupByRecordPresenters are loaded after the event is fired you can use the Dispatcher’s BeginInvoke method in order to execute the code stippet after the GroupByRecordPresenters are already added to the visal tree. You can do that as follows:
Dispatcher.BeginInvoke(
new Action(() => {
//Add the above code snippet here
}), System.Windows.Threading.DispatcherPriority.Background, null);
If you require any further clarifications please do not hesitate to ask.
Thanks - your example certainly works, but my scenario is slightly different. I'm using a pre-defined style that includes the GroupByRecordPresenter style already overridden - and contained in a separate assembly. So when I try and use the code in your sample it doesn't work, I'm assuming because the style then gets overridden by what I've defined already.
Is there an alternative solution you're aware of?
I have created a sample application that demonstrates an approach for adding additionl text in the GroupByRecord. In the sample application I use a style for the GroupByRecordPresenter with an EventSetter for its Loaded event. In the event handler using the Utilities class I get the TextBlock that holds the text displayed in the GroupByRecord and adds additional text in the TextBlock.