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?