I've spent enough time on this that it's probably best to ask for help.
The SL DataGrid works great for us at this point with one exception. For one user group we needed to display a column based on some aggregate logic and displayed as a checkbox. This checkbox determines how they should treat the record, and it would be great to Group and/or Order on this column, but it shows a red 'X' when I try to drag the column to the grouping, and does nothing when I click to sort on it.
Here is the .xaml
<telerik:GridViewDataColumn
DataMemberBinding="{Binding Converter={StaticResource HasProduct}}"
Header="Has Product?"
IsReadOnly="True"
IsGroupable="True">
<telerik:GridViewColumn.CellTemplate>
<DataTemplate>
<CheckBox
IsEnabled="False"
IsChecked="{Binding Converter={StaticResource HasProduct}}"/>
</DataTemplate>
</telerik:GridViewColumn.CellTemplate>
</telerik:GridViewDataColumn>
I am sure that I have over-specified the data source, but that was introduced as part of frustrated troubleshooting.
The converter is defined as follows:
public class HasProduct :IValueConverter
{
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
bool HasProduct = false;
Order o = value as Order;
foreach (OrderDetail od in o.OrderDetails)
{
if (od.Category == "Product")
HasProduct = true;
}
return HasProduct;
}
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
throw new NotImplementedException();
}
Any guidance on why this boolean field cannot be grouped/sorted and how best to fix that would be most welcome.
Thanks!
The SL DataGrid works great for us at this point with one exception. For one user group we needed to display a column based on some aggregate logic and displayed as a checkbox. This checkbox determines how they should treat the record, and it would be great to Group and/or Order on this column, but it shows a red 'X' when I try to drag the column to the grouping, and does nothing when I click to sort on it.
Here is the .xaml
<telerik:GridViewDataColumn
DataMemberBinding="{Binding Converter={StaticResource HasProduct}}"
Header="Has Product?"
IsReadOnly="True"
IsGroupable="True">
<telerik:GridViewColumn.CellTemplate>
<DataTemplate>
<CheckBox
IsEnabled="False"
IsChecked="{Binding Converter={StaticResource HasProduct}}"/>
</DataTemplate>
</telerik:GridViewColumn.CellTemplate>
</telerik:GridViewDataColumn>
I am sure that I have over-specified the data source, but that was introduced as part of frustrated troubleshooting.
The converter is defined as follows:
public class HasProduct :IValueConverter
{
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
bool HasProduct = false;
Order o = value as Order;
foreach (OrderDetail od in o.OrderDetails)
{
if (od.Category == "Product")
HasProduct = true;
}
return HasProduct;
}
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
throw new NotImplementedException();
}
Any guidance on why this boolean field cannot be grouped/sorted and how best to fix that would be most welcome.
Thanks!