Skip to main content

Column sort ina a data grid

  • March 3, 2016
  • 6 replies
  • 0 views

Alberto Ferraz

Hello,

In dataGrid with numeric fields (e.g., customer code) when I SORT column is all sorted alphabetically, that is, the 161 appears after 1161 (for example).
Is there a way to order the same code?
Thanks
Alberto Ferraz

6 replies

Lanter Werner
  • Participating Frequently
  • March 3, 2016

Hello,

In dataGrid with numeric fields (e.g., customer code) when I SORT column is all sorted alphabetically, that is, the 161 appears after 1161 (for example).
Is there a way to order the same code?
Thanks
Alberto Ferraz

Using WPF-Binding this works well. Remember PIC 9(4) is not a numeric value for .Net.

Can you show me your XAML and the property definition.

Freundliche Grüsse

Werner Lanter


Alberto Ferraz
  • Author
  • Participating Frequently
  • March 3, 2016

Hello,

In dataGrid with numeric fields (e.g., customer code) when I SORT column is all sorted alphabetically, that is, the 161 appears after 1161 (for example).
Is there a way to order the same code?
Thanks
Alberto Ferraz

Hello,

The XAML definitions of CODIG field.

               <DataGridTextColumn Binding="{Binding CODIG, Mode=OneWay}" ClipboardContentBinding="{x:Null}" Header="Código" SortDirection="Descending" CanUserResize="False" FontSize="14" Width="60">

                   <DataGridTextColumn.HeaderStyle>

                       <Style>

                           <Setter Property="Control.HorizontalContentAlignment" Value="Center" />

                           <Setter Property="Control.Background" Value="Tan" />

                           <Setter Property="Control.Foreground" Value="Blue"/>

                           <Setter Property="Control.FontWeight" Value="Bold"/>

                       </Style>

                   </DataGridTextColumn.HeaderStyle>

                   <DataGridTextColumn.CellStyle>

                       <Style>

                           <Setter Property="TextBlock.TextAlignment" Value="Center" />

                       </Style>

                   </DataGridTextColumn.CellStyle>

               </DataGridTextColumn>

Best Regards

Alberto Ferraz


Lanter Werner
  • Participating Frequently
  • March 3, 2016

Hello,

In dataGrid with numeric fields (e.g., customer code) when I SORT column is all sorted alphabetically, that is, the 161 appears after 1161 (for example).
Is there a way to order the same code?
Thanks
Alberto Ferraz

Can you also show me the property definition of CODIG in the Cobol source.


Alberto Ferraz
  • Author
  • Participating Frequently
  • March 3, 2016

Hello,

In dataGrid with numeric fields (e.g., customer code) when I SORT column is all sorted alphabetically, that is, the 161 appears after 1161 (for example).
Is there a way to order the same code?
Thanks
Alberto Ferraz

Definition on Cobol Source

Working Storage:

01 WRK-CODIG PIC 9(8).

Instruction to Binding

    set custCli::CODIG to WRK-CODIG

Definition on Class-Id.

      01 WRX-CODIG string property as "CODIG".


Lanter Werner
  • Participating Frequently
  • March 3, 2016

Hello,

In dataGrid with numeric fields (e.g., customer code) when I SORT column is all sorted alphabetically, that is, the 161 appears after 1161 (for example).
Is there a way to order the same code?
Thanks
Alberto Ferraz

Make the following chage:

Definition on Class-Id.

     01 WRX-CODIG binary-long property as "CODIG".


Alberto Ferraz
  • Author
  • Participating Frequently
  • March 3, 2016

Hello,

In dataGrid with numeric fields (e.g., customer code) when I SORT column is all sorted alphabetically, that is, the 161 appears after 1161 (for example).
Is there a way to order the same code?
Thanks
Alberto Ferraz

It's perfect. Thanks again.

Best Regards

Alberto Ferraz