How do I change the content of a single GroupByFieldLabel without affecting the rest of the fields or affecting the DataItem Field?
I don't see anything I can use in the GroupByArea.AvailableFieldLabels[index]
Thanks!
Hello MagellanTX,
This is by no means a complete solution but it may point you in the right direction. You can set a style in XAML and set the ControlTemplate of the GroupByAreaFieldLabel and assign to the appropriate label in code:
<Style x:Key="myStyle" TargetType="{x:Type igDP:GroupByAreaFieldLabel}"> <Setter Property="Template"> <Setter.Value> <ControlTemplate> <Button Content="Hi, I'm a Button!"/> </ControlTemplate> </Setter.Value> </Setter> </Style>
grid.GroupByArea.AvailableFieldLabels[0].Style = (Style)this.Resources["myStyle"];
Hope that helps
Thank you for the reply. I was able to get the style to work but I lost the drag & drop function. My button is not visible in code so I'm not sure the best way to go here.
Hello,
You lost the Drag&Drop functionality because the style did not include all the elements needed for this.
You can see the default style for this labels in the DefaultStyles directory in the Infragistics Folder on your computer.
I have created a more extent style which has kept the drag-drop function, but it is not the whole style ( the triggers, resources and brushes are missing you can see them in the DefaultStyles as mentioned above)
<Style TargetType="{x:Type igDP:GroupByAreaFieldLabel}">
<Setter Property="LayoutTransform">
<Setter.Value>
<ScaleTransform ScaleX="1" ScaleY="1"/>
</Setter.Value>
</Setter>
<Setter Property="RenderTransform">
<ScaleTransform ScaleX="1" ScaleY="1" />
<Setter Property="Template">
<ControlTemplate TargetType="{x:Type igDP:GroupByAreaFieldLabel}">
<Grid x:Name="outerGrid" SnapsToDevicePixels="True"
RenderTransformOrigin="0.5,0.5">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Grid.RenderTransform>
</Grid.RenderTransform>
<Rectangle
Stroke="{TemplateBinding BorderBrush}"
StrokeThickness="1"
RadiusX="3" RadiusY="3"
Fill="{TemplateBinding Background}" />
<Rectangle x:Name="labelHighlight" StrokeThickness="1" RadiusX="3" RadiusY="3"
Opacity="0" />
<TextBlock Margin="{TemplateBinding Padding}"
Text="My Modified Label" />
</Grid>
</ControlTemplate>
</Style>
The final thing to do is to set x:key and apply it to different labels as Aaron suggested.
Alex.