1

我正在关注 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 .<>c_ DisplayClass1.b_0(Object o) at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs) at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, 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) at System.Windows.DependencyObject.SetEffectiveValue(DependencyProperty property, EffectiveValueEntry& newEntry, Object newValue) at System.Windows.DependencyObject.UpdateEffectiveValue(DependencyProperty property, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, ValueOperation操作)在 System.Windows.DependencyObject.RefreshExpression(DependencyProperty dp) 在 System.Windows.Data。

4

0 回答 0