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
175
Aligning column contents, formatting cell values
posted

I'm using the XamDataPresenter with a GridView for the view, in the new NetAdvantage for WPF beta.  I need to do two simple things, but I can't seem to find the answer:

 

1. How can I set alignment of cell values by column/field? For example, I'd like to left align one integer field/column, center align another integer field/column, and right align yet another (the default).

 2. How can I format cell values by column/field? For example, I'd like one double field to always have at least 2 decimal places, another double field to be formatted as currency, and an integer field formatted as a phone number.

 

Examples would be excellent, but if anyone can at least just point me in the right direction I'm sure I can figure it out. I've been searching through help files and Mole for over an hour and haven't figured this out yet. 

Parents
  • 4850
    Offline posted

    Here is an example of setting up the masking for a phone number field using a XamMaskedEditor:

    <igDP:XamDataPresenter.FieldLayouts>

    <igDP:FieldLayout>

    <igDP:FieldLayout.Fields>

    <igDP:Field Name="Phone number">

    <igDP:Field.Settings>

    <igDP:FieldSettings EditorType="{x:Type igEditors:XamMaskedEditor}">

    <igDP:FieldSettings.EditorStyle>

    <Style TargetType="igEditors:XamMaskedEditor">

    <Setter Property="HorizontalAlignment" Value="Center"/>

    <Setter Property="Mask" Value="(###)###-####"/>

    </Style>

    </igDP:FieldSettings.EditorStyle>

    </igDP:FieldSettings>

    </igDP:Field.Settings>

    </igDP:Field>

    </igDP:FieldLayout.Fields>

    </igDP:FieldLayout>

    </igDP:XamDataPresenter.FieldLayouts>

    Note: all of the editors also expose a Format property for use when the cell is not in edit mode. I hope this helps.

     

Reply Children
No Data