Note that there are some explanatory texts on larger screens.

plurals
  1. POWPF datagrid sort bug
    primarykey
    data
    text
    <p>I'm trying to get my column to sort using the datagrid <code>SortMemberPath="COLUMN"</code> attribute and I get a weird sort order like so:</p> <p><img src="https://i.stack.imgur.com/cUkPm.jpg" alt="enter image description here"></p> <p>It looks like the column is sorted on the basis of the first digit of the number and not the entire number. How can I fix this?</p> <p>Edit:</p> <p>Okay, I see what the problem is. I'm using this converter now but still no change. </p> <pre><code>public class IntToStringConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { if (value is string) { string s = (string)value; int num; if (int.TryParse(s, out num)) return Int32.Parse(s); } return DependencyProperty.UnsetValue; } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { int number = (int)value; return number.ToString(); } } </code></pre> <p>I added this to my xaml file Windows.Resource: </p> <pre><code>&lt;me:IntToStringConverter x:Key="IntToStringConverter"/&gt; </code></pre> <p>and made this change in my data part:</p> <pre><code>&lt;toolkit:DataGridTemplateColumn.CellTemplate&gt; &lt;DataTemplate&gt; &lt;TextBlock Text="{Binding MinRun, Converter={StaticResource IntToStringConverter}}" HorizontalAlignment="Center" /&gt; &lt;/DataTemplate&gt; &lt;/toolkit:DataGridTemplateColumn.CellTemplate&gt; </code></pre> <p>Here is the DataGrid part of the XAML. Note that out of all the columns, I'm first trying to get the 'MinRun' column to sort properly first, then I'll use the same technique on the other columns. </p> <p><a href="http://pastebin.com/ec14p4ks" rel="nofollow noreferrer">http://pastebin.com/ec14p4ks</a></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload