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
1865
format field values as Percent.
posted

Hi,

To format a column as percent, I usually use a custom style with TargetType="{x:Type igEditors:XamTextEditor}" and then apply it to the fields I want to format as percent by setting it's EditorStyle to the above StaticResource.

However, in this case, I do not know the field names at design time and I have AutoGenerateFields="True". I know that the underlying DataTable has 1 string field and N decimal fields. All decimal fields need to be formated as percent.  Also, I want all column widths to be set to 60.

Thanks.

  • 27093
    posted

    Hello Jay6447,

    I am just checking the progress of this issue and was wondering if you managed to achieve your goal or if you need any further assistance on the matter.

    If the above suggestion helped you solve your issue please verify the thread as answered so other users may take better advantage of it.

  • 27093
    posted

    Hello Jay6447,

     

    I have been looking into this and I can suggest creating an implicit (keyless) Style in the XamDataGrid’s Resources for the XamCurrencyEditor that is used by default by the XamDataGrid for Decimal properties. You can also set the XamDataGrid’s global FieldSettings to have a Width property of 60. Here is a xaml snippet you can test out:

     

    <igDP:XamDataGrid x:Name="xamDataGrid1" >

        <igDP:XamDataGrid.Resources>

            <Style TargetType="{x:Type igEditors:XamCurrencyEditor}">

                <Setter Property="Format" Value="P" />

            </Style>

        </igDP:XamDataGrid.Resources>

        <igDP:XamDataGrid.FieldSettings>

            <igDP:FieldSettings Width="60" />

        </igDP:XamDataGrid.FieldSettings>

    </igDP:XamDataGrid>

     

    Please let me know, if I can be of any further assistance on the matter.