In my XamDataGrid resources I was able to right-align the summaries with:
<Style TargetType="{x:Type igDP:SummaryResultPresenter}"> <Setter Property="HorizontalAlignment" Value="Right" /> </Style>
I need to right align cells as well - but I don't want to use a resource style because it will right-align everything. I only have a few fields that need to be right aligned. What would the XAML look like if I wanted to right-align on a field by field basis?
Thanks!
Hello,
If you want to right-align only specific field in you XamDataGrid you can add a style for the CellValuePresener in its Resource section with a x:Key as follows:
<igDP:XamDataGrid.Resources>
<Style TargetType="{x:Type igDP:CellValuePresenter}"
x:Key="RightAligned">
<Setter Property="HorizontalAlignment" Value="Right"/>
</Style>
</igDP:XamDataGrid.Resources>
After doing so, you can set this style for fields that you want by setting the CellValuePresenterStyle property of its FieldSettings like this:
<igDP:Field Name="name" Label="Name">
<igDP:Field.Settings>
<igDP:FieldSettings
CellValuePresenterStyle="{StaticResource RightAligned}"/>
</igDP:Field.Settings>
</igDP:Field>
By following this approach you right-align only the fields that have CellValuePresenterStyle set to the style above.
If you require any further assistance please do not hesitate to ask.
Sincerely,
Krasimir
Developer Support Engineer
Infragistics
www.infragistics.com/support
Krasimir,
Thanks for this answer. It helped me.
Hello Mike,
I am very glad that my replay was helpful for you. Please let me know if you need any further assistance on this.
Hi Krasimir,
I am not able to Right / Center align the Cell. The property type is a string and the cell is always left Aligning.
Here is the Xaml:
<UserControl x:Class="MyApp.SimpleReport_Test" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:igDP="clr-namespace:Infragistics.Windows.DataPresenter;assembly=InfragisticsWPF4.DataPresenter.v10.3" xmlns:Editors="clr-namespace:Infragistics.Windows.Editors;assembly=InfragisticsWPF4.Editors.v10.3" mc:Ignorable="d" d:DesignHeight="429" d:DesignWidth="504"> <igDP:XamDataGrid DataSource="{Binding HierchData}" Name="xamDataGrid1" > <igDP:XamDataGrid.Resources> <Style TargetType="{x:Type igDP:CellValuePresenter}" x:Key="RightAligned" > <Setter Property="HorizontalContentAlignment" Value="Center" /> <Setter Property="Background" Value="Green" /> <Setter Property="HorizontalAlignment" Value="Center"></Setter> <Setter Property="BorderBrush" Value="Blue"></Setter> <Setter Property="BorderThickness" Value="2"></Setter> </Style> </igDP:XamDataGrid.Resources> <igDP:XamDataGrid.FieldLayouts> <igDP:FieldLayout Key="MyLayout"> <igDP:FieldLayout.Fields> <igDP:Field Name="DisplayName"> </igDP:Field> <igDP:Field Name="AumFmt" Label="AumFmt" > <igDP:Field.Settings> <igDP:FieldSettings CellWidth="220" ></igDP:FieldSettings> </igDP:Field.Settings> </igDP:Field> <igDP:Field Name="MtdPerformanceFmt" Label="MTD Performance" > <igDP:Field.Settings > <igDP:FieldSettings CellValuePresenterStyle="{StaticResource RightAligned}" LabelTextAlignment="Right" CellContentAlignment="LabelAboveValueAlignRight"> </igDP:FieldSettings> </igDP:Field.Settings> </igDP:Field> </igDP:FieldLayout.Fields> </igDP:FieldLayout> </igDP:XamDataGrid.FieldLayouts> </igDP:XamDataGrid></UserControl>
Here is the code to fill the objects:
HiercData = new ObservableCollection<MyObject>(); MyObject dpr = new MyObject(); dpr.DisplayName = "TEST"; dpr.Aum = 100000000.444; dpr.MtdPerformance = .010; ////mDailyData.Add(dpr); HierchDailyData.Add(dpr); // MessageBox.Show("DailyPerfReport const 3 - Binding"); //// DailyDataToHierarchyCollection(); // MessageBox.Show("DailyPerfReport const 4 - Binding Done"); this.DataContext = this;
Can you see what I am doing wrong?
Thanks,
Sandy
Just figured this one out. It was a bug in Infragistics 10.3.20103.1003 just upgarded to 10.3.20103.2337 and it works fine.
Thanks,Sandy
Hello Sandy,
Thank you for your post. I am very glad that you managed to resolve the issue that you are having. Please let me know if you need any further assistance on the matter.
Krasimir, MCPD
Developer Support Supervisor - XAML