I have a XamDataGrid with columns that contain a different set of numbers depending on the row they are located in. For example, the first row contains the amount of money available for you. The second row contains the closing price of a stock from yesterday. The third row contains the live price and the change in price from yesterday. So it looks something like:
| Available | 1,000 |
| Previous | 88.00 |
| Live | 65.25 (-22.75) |
Is it possible to line up the data based on the decimal points? For example, the 88.00 would be directly over the 22.75 in the Live row and the last 2 00s from the Available row would be over the 22 and 88 respectively. I'm sure there has to be some style or converter out there but I can't seem to generate it.
Your description is a little hard to follow, but I'll take a stab at a possible answer.
From what you pasted it looks like your record orientation is set to horizontal, and you'd like to align the cell values. One possible way would be to create a style that right aligns the values like below.
<igDP:XamDataGrid.Resources>
<Style TargetType="{x:Type igDP:CellValuePresenter}" x:Key="RightAlignedValueStyle">
<Setter Property="HorizontalAlignment" Value="Right" />
<Setter Property="Padding" Value="0,0,5,0" />
</Style>
</igDP:XamDataGrid.Resources>
<igDP:XamDataGrid.FieldLayouts>
<igDP:FieldLayout>
<igDP:Field Name="Available">
<igDP:Field.Settings>
<igDP:FieldSettings CellValuePresenterStyle="{StaticResource RightAlignedValueStyle}" />
</igDP:Field.Settings>
</igDP:Field>
<igDP:Field Name="Previous">
<igDP:Field Name="Live">
</igDP:FieldLayout>
</igDP:XamDataGrid.FieldLayouts>
How do I right align the contents of xamdatagrid of type decimal?Please help me out, I want to display **currency which is of type decimal**. I want to have two decimal points (XXXX.XX)?
also,how do I do it if the datatype is string
<Style TargetType="{x:Type igDP:CellValuePresenter}" x:Key="RightAlignedValueStyle" BasedOn="{StaticResource SmallCellValueStyle}" > <Setter Property="HorizontalContentAlignment" Value="Right" /> </Style>
This is the style i have added
<igDP:Field Name="ApproximatePrice" Label="Approximate price" Width="100"> <igDP:Field.Settings> <igDP:FieldSettings LabelPresenterStyle="{StaticResource MultilineHeader}" CellClickAction="SelectRecord" CellValuePresenterStyle="{StaticResource RightAlignedValueStyle}" /> </igDP:Field.Settings> </igDP:Field>