Hi,
I am getting the following exception in the design view of Expression Blend when I try to view a usercontrol which contains a XamGrid:
AgrumentException: Value does not fall within the expected range.
at Ms.Internal.XcpImports.MethodEx(IntPtr ptr, String name, CValue[] cvData_
at MS.Internal.XcpImports.MethodEx(DependencyObject obj, String name)
at MS.Internal.XcpImports.UIElement_UpdateLayout(UIElement element)
Here is my XAML:
<UserControl xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:ig="http://schemas.infragistics.com/xaml" x:Class="MyGridExample"> <ig:XamGrid x:Name="MyGrid" DataContext="{Binding}" ItemsSource="{Binding Rows}"> <ig:XamGrid.Columns> <ig:TextColumn Key="Property1"> <ig:TextColumn.HeaderTemplate> <DataTemplate> <TextBlock Text="Property1" /> </DataTemplate> </ig:TextColumn.HeaderTemplate> </ig:TextColumn> </ig:XamGrid.Columns> </ig:XamGrid></UserControl>
Xaml codebehind:
public partial class MyGridExample : UserControl { public MyGridExample() { InitializeComponent(); DataContext = new GridViewModel(); } }
ViewModel class:
public class GridViewModel { public ObservableCollection<Row> Rows { get; set; } public GridViewModel() { Rows = new ObservableCollection<Row> { new Row { Property1 = "test" }}; }
}
Model:
public class Row { public string Property1 { get; set; } }
I also get a similar exception when opening most of the Grid samples xaml files from the code samples provided in Infragistics.Web.SLLOB.sln; i.e.:ExportToWord.xaml, ExportToWordEvents.xaml, ExportToWordLayoutSettings.xaml, GridDataBinding.xaml, GridViewModel.xaml, HierarchicalData.xaml, ColumnChooser.xaml, ColumnMoving,xaml, ColumnResizing.xaml, ColumnTypeMappings.xaml, ColumnTypes.xaml, ComboBoxColumn.xaml, ConditionalFormattingRules.xaml, DateColumns.xaml, FixedColumns.xaml, GroupColumns.xaml, IDataErrorInfoSupport.xaml, ImageColumns.xaml, RightToLeftSupport,xaml, StringIndexersSupport.xaml, TemplateColumnLayout.xaml, TemplateColumns.xaml, ToolTips.xaml, UnboundColumns.xaml.
Note that the following xaml files in the samples do not exhibit this problem:
DataAnnotations.xaml (this has a different error; Invalid XAML which may be masking the error)
HierarchnicalFinancialData.xml
SelfReferencingData.xml
Hello Andy,
It has been a while since you have made your post, in case you still need support I will be glad to assist you further. I suppose the other community members can benefit from this answer as well. I have been looking into your post and I created a sample project for you using the code you have provided and everything seems to work ok on my side. If the sample doesn’t satisfies all your needs feel free to modify it, so it reproduces your behavior and send it back to me for further investigation. Also I attached a screenshot from Expression Blend.
Feel free to write me if you have further questions.