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
310
Edit Mode Format
posted

I have a column with the format string set to currency. When the cell goes into edit mode it shows a total of 4 decimal places instead of 2. What is the easiest way to format the value in edit mode so that it will show only 2 decimal places? Thanks.

Parents
  • 40030
    Verified Answer
    Offline posted

    Hi, 

    So the easiest way is to apply a ValueConverter to the EditorValueConverter of the Column:

     public class MyEVC : IValueConverter
        {
            public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
            {
                return String.Format(culture,"{0:c}", value);
            }
    
            public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
            {
                return value;
            }
        }
    
      <ig:XamGrid.Columns>
                   <ig:TextColumn Key="ChapterNumber" FormatString="{}{0:c}" EditorValueConverter="{StaticResource evc}"/>
                </ig:XamGrid.Columns>
    

     

    
    
    Hope this helps, 
    -SteveZ

     

Reply Children
No Data