值不在RadGridView中的预期范围错误绑定范围内

时间:2011-03-03 15:32:45

标签: silverlight telerik radgridview

我正在关注Telerik发布的关于如何在RadGridView控件中显示/隐藏列的示例,如下所示:

        <StackPanel x:Name="CustomizeGrid" Background="Transparent" Orientation="Horizontal">
        <ListBox ItemsSource="{Binding Columns, ElementName=WorklistGridView}">
            <ListBox.ItemTemplate>
                <DataTemplate>
                    <CheckBox Content="{Binding Header}" IsChecked="{Binding IsVisible, Mode=TwoWay}" />
                </DataTemplate>
            </ListBox.ItemTemplate>
        </ListBox>
        <telerik:RadGridView x:Name="WorklistGridView" AutoGenerateColumns="False" RowIndicatorVisibility="Collapsed" IsReadOnly="True" SelectionMode="Multiple" 
                         CanUserSelect="False" IsSynchronizedWithCurrentItem="False" ItemsSource="{Binding Mode=OneWay}" IsFilteringAllowed="True">
            <telerik:RadGridView.Columns>
                <telerik:GridViewSelectColumn x:Name="Select" IsResizable="False" />
                <telerik:GridViewDataColumn Header="Status" DataMemberBinding="{Binding OrderStatusDescription}"/>
                <telerik:GridViewDataColumn Header="Patient Name" DataMemberBinding="{Binding PatientName}"/>

但该示例未正确编译。问题出在这里: CheckBox Content =“{Binding Header}”

列出的主要错误是:值不在预期范围内。

我不确定为什么会这样。我将尝试发布下面的其余错误。有没有其他人有这个工作,或有任何想法是什么?

System.InvalidOperationException

尝试在设计图面上渲染当前的silverlight项目时遇到未处理的异常。要诊断此故障,请尝试使用silverlight开发人员运行时在常规浏览器中运行项目。    在Microsoft.Windows.Design.Platform.SilverlightViewProducer.OnUnhandledException(Object sender,ViewUnhandledExceptionEventArgs e)    在Microsoft.Expression.Platform.Silverlight.SilverlightPlatformSpecificView.OnUnhandledException(Object sender,ViewUnhandledExceptionEventArgs args)    在Microsoft.Expression.Platform.Silverlight.Host.SilverlightImageHost。&lt;&gt; c_ DisplayClass1.b _0(Object o)    在System.Windows.Threading.ExceptionWrapper.InternalRealCall(委托回调,对象args,Int32 numArgs)    在MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source,Delegate方法,Object args,Int32 numArgs,Delegate catchHandler)

System.ArgumentException 价值不在预期范围内。    在MS.Internal.XcpImports.CheckHResult(UInt32 hr)    在MS.Internal.XcpImports.SetValue(IManagedPeerBase obj,DependencyProperty属性,DependencyObject doh)    在MS.Internal.XcpImports.SetValue(IManagedPeerBase doh,DependencyProperty属性,Object obj)    在System.Windows.DependencyObject.SetObjectValueToCore(DependencyProperty dp,Object value)    在System.Windows.DependencyObject.SetEffectiveValue(DependencyProperty属性,EffectiveValueEntry&amp; newEntry,Object newValue)    在System.Windows.DependencyObject.UpdateEffectiveValue(DependencyProperty属性,EffectiveValueEntry oldEntry,EffectiveValueEntry&amp; newEntry,ValueOperation操作)    在System.Windows.DependencyObject.RefreshExpression(DependencyProperty dp)    在System.Windows.Data.BindingExpression.SendDataToTarget()    在System.Windows.Data.BindingExpression.SourceAcquired()    在System.Windows.Data.BindingExpression.System.Windows.IDataContextChangedListener.OnDataContextChanged(Object sender,DataContextChangedEventArgs e)    在System.Windows.Data.BindingExpression.DataContextChanged(Object sender,DataContextChangedEventArgs e)    在System.Windows.DataContextChangedEventHandler.Invoke(Object sender,DataContextChangedEventArgs e)    在System.Windows.FrameworkElement.OnDataContextChanged(DataContextChangedEventArgs e)    在System.Windows.FrameworkElement.OnTreeParentUpdated(DependencyObject newParent,Boolean bIsNewParentAlive)    在System.Windows.DependencyObject.UpdateTreeParent(IManagedPeer oldParent,IManagedPeer newParent,Boolean bIsNewParentAlive,Boolean keepReferenceToParent)    在MS.Internal.FrameworkCallbacks.ManagedPeerTreeUpdate(IntPtr oldParentElement,IntPtr parentElement,IntPtr childElement,Byte bIsParentAlive,Byte bKeepReferenceToParent,Byte bCanCreateParent)

0 个答案:

没有答案