Maybe this is glaringly obvious, but I've searched the forums and looked at the documentation and can't find anything that describes how it is possible to individually align columns. I know flowdirection will make a grid align one way or the other, but I'd like to have one column aligned left and one aligned right. Is there any way to accomplish this?
EDIT: Okay, I've found that you can set the FlowDirection of the DataRecordCellArea, but is it possible to set that in the codebehind? If not, where would I need to put it in an itemspaneltemplate that has a grid?
Thanks,Matt
Hi Matt,
One way to do it is to specify the HorizontalAlignment for the editor used in the cell, e.g.
<igDP:FieldLayout>
<igDP:FieldLayout.Fields>
<igDP:Field Name="Phone number">
<igDP:Field.Settings>
<igDP:FieldSettings EditorType="{x:Type igEditors:XamMaskedEditor}">
<igDP:FieldSettings.EditorStyle>
<Style TargetType="igEditors:XamMaskedEditor">
<Setter Property="HorizontalAlignment" Value="Center"/>
<Setter Property="Mask" Value="(###)###-####"/>
</Style>
</igDP:FieldSettings.EditorStyle>
</igDP:FieldSettings>
</igDP:Field.Settings>
</igDP:Field>
</igDP:FieldLayout>
</igDP:XamDataPresenter.FieldLayouts>
Hi Joe
What about horizontal alignment in the column headers? I've opened a support request a long time ago, but support couldn't help me as it appeared this got somewhat lost (the possible overrides screwed up themes). Is this supported with 7.2?
Cheers,
Philipp
Ok I figured this one out on my own. I added a style for the cellvaluepresenter and it works like a charm
<Style TargetType="{x:Type igDP:CellValuePresenter}" x:Key="TopAlignField"> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type igDP:CellValuePresenter}"> <igEditors:XamTextEditor Margin="{TemplateBinding Padding}" Width="{TemplateBinding Width}" Height="{TemplateBinding Height}" VerticalScrollBarVisibility="Disabled" Text="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Content}" Background="Transparent" BorderThickness="0" BorderBrush="Transparent" HorizontalAlignment="Stretch" IsEnabled="False" VerticalAlignment="Top"/> </ControlTemplate> </Setter.Value> </Setter> </Style>
set the fields cellvaluepresenter style to it and it works
<igDP:Field Name="LogID" Column="0" Label="Log ID"> <igDP:Field.Settings> <igDP:FieldSettings CellValuePresenterStyle="{StaticResource TopAlignField}" AllowEdit="False" CellWidth="60" LabelMaxWidth="60" CellMaxWidth="60" /> </igDP:Field.Settings> </igDP:Field>
Is there any way to set the vertical alingment for the text@
I have a grid with several cells that wrap and the "unwrapped" cells have the text vertically aligned in the center of the cell by default
I need them to be "top" aligned.
anyway to to this?
Hi Philipp,
You should be able to do what you need by supplying a style for LabelPresenter. However, there is easier way. There is a property exposed off FieldSettings called CellContentAlignment. This property was exposed mainly for use in situations where the labels are with the cells, i.e. not in a separate header. It controls the placement of the cell relative to the label. However, even in the default case where there is a separate header it should affect the horizontal alignment of the label. Try setting it to something like 'LabelAboveCellAlignRight'.
I hope this helps.