Hello.
There are grid below. I need to set one margin of header text in first and last colmns and another margin of header text in others columns. I tried to doit by implementing DataTrigger in LabelPresenterStyle, but it doesn`t work. How can I do it?
<Style TargetType="{x:Type igDP:LabelPresenter}" BasedOn="{StaticResource LabelPresenterStyle}" > <Style.Setters>
<Setter Property="FontFamily" Value="Segoe UI"/> <Setter Property="BorderThickness" Value="1,0,1,0"/> <Setter Property="OuterBorderBrush" Value="White"/> <Setter Property="FontSize" Value="16"/> <Setter Property="Foreground" Value="{StaticResource MetroHyperlinkForegroundColor}"/> <Setter Property="Background" Value="{StaticResource MetroWindowFooterBackgroundColor}"/> <Setter Property="ContentTemplate"> <Setter.Value> <DataTemplate> <TextBlock Name="textBlock" Margin="8,0,8,0" Text="{TemplateBinding Content}"/> <DataTemplate.Triggers> <DataTrigger Binding="{Binding Path=Field, RelativeSource={RelativeSource AncestorType={x:Type igDP:LabelPresenter}}}" Value="Field: OrderNumber"> <Setter TargetName="textBlock" Property="TextBlock.Margin" Value="16,0,16,0"/> </DataTrigger> <DataTrigger Binding="{Binding Path=Field, RelativeSource={RelativeSource AncestorType={x:Type igDP:LabelPresenter}}}" Value="Field: Comment"> <Setter TargetName="textBlock" Property="TextBlock.Margin" Value="16,0,16,0"/> </DataTrigger> </DataTemplate.Triggers> </DataTemplate> </Setter.Value> </Setter> </Style.Setters> </Style> <igDP:XamDataGrid Name="DataGrid" GroupByAreaLocation="None" DataContext="{Binding}" DataSource="{Binding Path=Attachments}" ActiveDataItem="{Binding Path=SelectedAttachment, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" AutoFit="True" > <i:Interaction.Behaviors> <behaviors:XamDataGridSelectedItemsBehavior SelectedItems="{Binding Path=SelectedItems}" /> </i:Interaction.Behaviors> <i:Interaction.Triggers> <i:EventTrigger EventName="MouseDoubleClick"> <triggerActions:InvokeDelegateCommandAction Command="{Binding Path=DoubleClickCommand}" /> </i:EventTrigger> </i:Interaction.Triggers> <igDP:XamDataGrid.FieldSettings> <igDP:FieldSettings AllowEdit="False" AllowFixing="No" LabelTextAlignment="Center" LabelTextTrimming="CharacterEllipsis" LabelTextWrapping="NoWrap" SortComparisonType="CaseInsensitive" CellClickAction="SelectRecord" AllowRecordFiltering="False"/> </igDP:XamDataGrid.FieldSettings> <igDP:XamDataGrid.FieldLayoutSettings>
<igDP:FieldLayoutSettings HeaderPresenterStyle="{StaticResource HeaderStyle}" AllowDelete="False" AutoGenerateFields="False" SelectionTypeRecord="Extended" HighlightAlternateRecords="True" SelectionTypeField="none" RecordSelectorLocation="None" HeaderPlacementInGroupBy="OnTopOnly" ResizingMode="Immediate" SelectionTypeCell="None" DataRecordCellAreaStyle="{StaticResource DataRecordStyle}" DataRecordPresenterStyle="{StaticResource DataRecordPresenterStyle}"> </igDP:FieldLayoutSettings> </igDP:XamDataGrid.FieldLayoutSettings> <igDP:XamDataGrid.FieldLayouts> <igDP:FieldLayout IsDefault="False" > <igDP:Field Name="OrderNumber" Label="OrderNumber" AllowEdit="True" Width="auto" > <igDP:Field.Settings> <igDP:FieldSettings CellValuePresenterStyle="{StaticResource NumberCell}" FilterOperandUIType="Default" FilterOperatorDefaultValue="Contains" FilterOperatorDropDownItems="Contains" /> </igDP:Field.Settings> </igDP:Field> <igDP:Field Name="State" Label="State" Width="auto" > <igDP:Field.Settings> <igDP:FieldSettings CellValuePresenterStyle="{StaticResource StatusAtachmentCell}" FilterOperandUIType="Default" FilterOperatorDefaultValue="Contains" FilterOperatorDropDownItems="Contains" /> </igDP:Field.Settings> </igDP:Field> <igDP:Field Name="FileName" Label="Document"> <igDP:Field.Settings> <igDP:FieldSettings CellValuePresenterStyle="{StaticResource DocumentAtachmentCell}" FilterOperandUIType="Default" FilterOperatorDefaultValue="Contains" FilterOperatorDropDownItems="Contains" /> </igDP:Field.Settings> </igDP:Field> <igDP:Field Name="Type" Label="Type" Width="auto"> <igDP:Field.Settings> <igDP:FieldSettings CellValuePresenterStyle="{StaticResource TypeAtachmentCell}" FilterOperandUIType="Default" FilterOperatorDefaultValue="Contains" FilterOperatorDropDownItems="Contains" /> </igDP:Field.Settings> </igDP:Field> <igDP:Field Name="Foundation" Label="Foundation"> <igDP:Field.Settings> <igDP:FieldSettings CellValuePresenterStyle="{StaticResource FoundationAtachmentCell}" FilterOperandUIType="Default" FilterOperatorDefaultValue="Contains" FilterOperatorDropDownItems="Contains" /> </igDP:Field.Settings> </igDP:Field> <igDP:Field Name="CountSign" Label="Signature Count" Width="auto"> <igDP:Field.Settings> <igDP:FieldSettings CellValuePresenterStyle="{StaticResource CountSignAtachmentCell}" FilterOperandUIType="Default" FilterOperatorDefaultValue="Contains" FilterOperatorDropDownItems="Contains" /> </igDP:Field.Settings> </igDP:Field> <igDP:Field Name="Comment" Label="Comment" > <igDP:Field.Settings> <igDP:FieldSettings CellValuePresenterStyle="{StaticResource CommentAtachmentCell}" FilterOperandUIType="Default" FilterOperatorDefaultValue="Contains" FilterOperatorDropDownItems="Contains" /> </igDP:Field.Settings> </igDP:Field> </igDP:FieldLayout> </igDP:XamDataGrid.FieldLayouts> </igDP:XamDataGrid>
Hello,
Thank you for contacting Infragistics. I see you started creating separate FieldSettings per field. From there you can set the LabelPresenterStyle and customize each Field as needed. This was previously discussed on the following forum post:https://es.infragistics.com/community/forums/t/4451.aspx
Let me know if you have any questions.