Hi,
how can i set left margin for cell value content in xamdatagrid??
Regards,
Jafar VM
Hi Jafar,
Cell content in the XamDataGrid is generally displayed via one of the Infragistics editor controls. XamTextEditor is the most common for text fields. You can create a style for this editor and set the margin in the style so that it will be applied to all cells in the grid.
<igDP:XamDataGrid> <igDP:XamDataGrid.Resources> <Style TargetType="{x:Type igEditors:XamTextEditor}"> <Setter Property="Margin" Value="15,1,1,1"/> </Style> </igDP:XamDataGrid.Resources> </igDP:XamDataGrid>
Hi Rob,
this is not working for me .my scenario is as follows
i have custom class derived from infragistics "Field" Class.In xaml iam using this custom class .
and i had set allow edit to false in field settings(so there will not be any option to edit cell value)
eg:-
public class CustomeField : Field
{
}
and my xaml is as follows.
<customField:CustomSortingField Name="FileName" Label="{tp:Localize fileName}" Visibility="Visible" Width="*"> <customField:CustomSortingField.Settings> <igDP:FieldSettings LabelPresenterStyle="{StaticResource LabelPresenterStyle}"> </igDP:FieldSettings> </customField:CustomSortingField.Settings> </customField:CustomSortingField>
Regards ,
I'm not sure what you mean by it's not working for you. I've attached a sample that demonstrates how it changes the margin on cell values. When you run the sample you will see that the values in each cell have been shifted over to the right a considerable amount. Was this not what you were looking for?
i changed my xaml as u told.but its not setting margin. my grid xaml is as follows.
<igDP:XamDataGrid Name="NodeArtifactGrid" Controls1:XamDataGridExtensions.SortingCommand="{Binding Path=Commands.NodeArtifactGridSorting}" Grid.Row="1" Margin="5,10,5,2" VerticalAlignment="Top" FlowDirection="LeftToRight" ActiveDataItem="{Binding Model.SelectedHierarchicalNodeArtifact,Mode=TwoWay}" DataSource="{Binding Model.HierarchicalNodeArtifactsList,Mode=TwoWay}" ScrollingMode="Deferred" GroupByAreaLocation="None" HorizontalAlignment="Stretch" BorderThickness="1" BorderBrush="LightGray" >
<igDP:XamDataGrid.Resources> <Style TargetType="{x:Type igEditors:XamTextEditor}"> <Setter Property="Margin" Value="50,1,1,1"/> </Style> </igDP:XamDataGrid.Resources>
<igDP:XamDataGrid.FieldLayoutSettings> <igDP:FieldLayoutSettings AllowDelete="False" DataRecordCellAreaStyle="{DynamicResource PCETReadOnlyDataRecordCellArea}" SelectionTypeRecord="Single" AutoGenerateFields="False" HighlightAlternateRecords="True" RecordSelectorLocation="None" AllowFieldMoving="No" RecordSelectorStyle="{DynamicResource PCET_XamDataGrid_RecordSelector}"></igDP:FieldLayoutSettings> </igDP:XamDataGrid.FieldLayoutSettings> <igDP:XamDataGrid.FieldSettings> <igDP:FieldSettings CellValuePresenterStyle="{DynamicResource PCET_ProjectArtifactTextReadOnly_CellValuePresenter}" LabelTextAlignment="Left" AllowEdit="False" CellClickAction="SelectRecord" AutoSizeOptions="All" Width="Auto" AutoSizeScope="AllRecords"/> </igDP:XamDataGrid.FieldSettings>
<igDP:XamDataGrid.FieldLayouts> <igDP:FieldLayout> <igDP:FieldLayout.Fields>
<customField:CustomSortingField Name="FileName" Label="{tp:Localize fileName}" Visibility="Visible" Width="*"> <customField:CustomSortingField.Settings> <igDP:FieldSettings LabelPresenterStyle="{StaticResource LabelPresenterStyle}" > </igDP:FieldSettings> </customField:CustomSortingField.Settings> </customField:CustomSortingField> <customField:CustomSortingField CustomSortIndicatorVisibility ="Visible" IsScrollTipField="False" Name="Date" Label="{tp:Localize date}" Visibility="Visible" Width="*"> <customField:CustomSortingField.Settings> <igDP:FieldSettings LabelPresenterStyle="{StaticResource LabelPresenterStyle}" > </igDP:FieldSettings> </customField:CustomSortingField.Settings> </customField:CustomSortingField> <customField:CustomSortingField IsScrollTipField="False" Name="ArtifactSize" Label="{tp:Localize size}" Converter="{StaticResource FileConverter}" Visibility="Visible" Width="*"> <customField:CustomSortingField.Settings> <igDP:FieldSettings LabelPresenterStyle="{StaticResource LastColumn}" > </igDP:FieldSettings> </customField:CustomSortingField.Settings> </customField:CustomSortingField>
</igDP:FieldLayout.Fields> </igDP:FieldLayout> </igDP:XamDataGrid.FieldLayouts> </igDP:XamDataGrid>
my custoem field class is
public class CustomSortingField : Field {
Are you retemplating the CellValuePresenter? I see you are providing you're own CellValuePresenter style to the FieldSettings of the XamDataGrid. If you are retemplating the cell then that would explain why my style isn't working for you. Can you provide the style you used for CellValuePresenter?
Do you still need assistance on this matter? If so can you provide the style you used for the CellValuePresenter?
thanks for ur post.that solved my issue.