Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
165
Rounding in XamCurrencyEditor
posted

<Grid>
    <ListBox x:Name="lstItems">
        <ListBox.ItemTemplate>
            <DataTemplate>
                <StackPanel Orientation="Horizontal">
                    <TextBlock>Value:</TextBlock>
                    <TextBlock Text="{Binding Value}"></TextBlock>
                    <igEditors:XamCurrencyEditor Value="{Binding Value, Mode=OneWay}" IsReadOnly="True"/>
                    <TextBlock>Expected:</TextBlock>
                    <TextBlock Text="{Binding ExpectedValue}"></TextBlock>
                </StackPanel>
            </DataTemplate>
        </ListBox.ItemTemplate>
    </ListBox>
</Grid>



List<TestItem> values = new List<TestItem>();


values.Add(new TestItem() { Value = 190.449m, ExpectedValue = 190.45m });
values.Add(new TestItem() { Value = 190.445m, ExpectedValue = 190.45m });
values.Add(new TestItem() { Value = 190.444m, ExpectedValue = 190.44m });
values.Add(new TestItem() { Value = 190.441m, ExpectedValue = 190.44m });
lstItems.ItemsSource = values;



Resut:



How can I tell the XamCurrencyEditor to (global) use MidPointRounding.AwayFromZero when displaying data?

 

Parents
  • 17559
    Verified Answer
    posted

    Hello tkrasinger,

     

    I have been looking through your question and I can suggest you set the Mask and Format properties of the editor as follows:

    Format="C2" Mask="{}{currency:6.2:c}"  

     

    This will force the editor to round the shown value and to display only two digits after the decimal point.             

     

    If you have any additional questions on this matter please feel free to ask.

Reply Children
No Data