Hi
My problem is simple and easy to repeat. Whenever I click on a column header in my XamWebGrid control the application/silverlight/browser goes into an infinite loop and must be killed. Everything else in the grid works fine, I can click my checkbox and they update the view model they are bound to. I am not sure what is causing this so I have included all the relevant details below.
I have the following XamWebGrid template for which I am dynamically generating the columns based on other controls selected else where.
<infragistics_DG:XamWebGrid x:Name="ContentGrid"
AutoGenerateColumns="False"
Margin="{TemplateBinding Margin}"
MaxDepth="3"
DeleteKeyAction="None">
<infragistics_DG:XamWebGrid.ColumnMovingSettings>
<infragistics_DG:ColumnMovingSettings AllowColumnMoving="Disabled"/>
</infragistics_DG:XamWebGrid.ColumnMovingSettings>
<infragistics_DG:XamWebGrid.FilteringSettings>
<infragistics_DG:FilteringSettings AllowFilterRow="None"/>
</infragistics_DG:XamWebGrid.FilteringSettings>
<infragistics_DG:XamWebGrid.ExpansionIndicatorSettings>
<infragistics_DG:ExpansionIndicatorSettings>
<infragistics_DG:ExpansionIndicatorSettings.Style>
<Style TargetType="igPrim:ExpansionIndicatorCellControl">
<Setter Property="Background" Value="Transparent"/>
</Style>
</infragistics_DG:ExpansionIndicatorSettings.Style>
</infragistics_DG:ExpansionIndicatorSettings>
</infragistics_DG:XamWebGrid.ExpansionIndicatorSettings>
<infragistics_DG:XamWebGrid.RowSelectorSettings>
<infragistics_DG:RowSelectorSettings Visibility="Collapsed" EnableRowNumbering="False"/>
</infragistics_DG:XamWebGrid.RowSelectorSettings>
<infragistics_DG:XamWebGrid.AddNewRowSettings>
<infragistics_DG:AddNewRowSettings AllowAddNewRow="None"/>
</infragistics_DG:XamWebGrid.AddNewRowSettings>
<infragistics_DG:XamWebGrid.EditingSettings>
<infragistics_DG:EditingSettings AllowEditing="None" />
</infragistics_DG:XamWebGrid.EditingSettings>
</infragistics_DG:XamWebGrid>
the code for generating the columns is,
ColumnBaseCollection columns = grid.Columns;
columns.Clear();
var branchNameCol = new TextColumn();
branchNameCol.Key = "TradingBranchLegalEntityAgreement.LegalEntity.Name";
branchNameCol.HeaderText = "Branch Name";
columns.Add(branchNameCol);
var branchProductLookupConverter = new BranchProductDictionaryLookupConverter();
foreach (Product product in BranchProductTable.DisplayProducts)
{
var productCol = new UnboundColumn();
productCol.Key = product.Id;
productCol.HeaderText = product.ShortName;
productCol.ValueConverter = branchProductLookupConverter;
productCol.ValueConverterParameter = product.Id;
productCol.HorizontalContentAlignment = HorizontalAlignment.Center;
productCol.HeaderStyle = new Style(typeof(HeaderCellControl));
productCol.HeaderStyle.Setters.Add(new Setter(HorizontalContentAlignmentProperty, HorizontalAlignment.Center));
productCol.HeaderTemplate = (DataTemplate)XamlReader.Load(
string.Format(
@"<DataTemplate xmlns='http://schemas.microsoft.com/winfx/2006/xaml/presentation'
xmlns:layout='clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Layout.Toolkit'>
<layout:LayoutTransformer>
<layout:LayoutTransformer.LayoutTransform>
<RotateTransform Angle='-80'/>
</layout:LayoutTransformer.LayoutTransform>
<TextBlock Text='{0}'/>
</layout:LayoutTransformer>
</DataTemplate>",
product.ShortName.Replace("&", "&")));
productCol.ItemTemplate = (DataTemplate)XamlReader.Load(
@"<DataTemplate xmlns='http://schemas.microsoft.com/winfx/2006/xaml/presentation'>
<CheckBox IsChecked='{Binding Value.IsSelected, Mode=TwoWay}'/>
</DataTemplate>");
columns.Add(productCol);
}
Ok, I've just discovered that switching off sorting fixes this problem for me.
<infragistics_DG:XamWebGrid.SortingSettings> <infragistics_DG:SortingSettings AllowSorting="False"/></infragistics_DG:XamWebGrid.SortingSettings>
Nether the less having an unbound column with a custom template shouldn't crash my browser when sorting is enabled.
Hi,
The ValueConverter on the UnboundColumn is used for sorting.
So my guess is you have some sort of logic inside there which is causing the app to hang.
-SteveZ