Telerik RadGridView + Style + RadDataPager = 找不到绑定 IsPinned 的源

Telerik RadGridView + Style + RadDataPager = Cannot find source for binding IsPinned

你好 SO 社区 :o)

首先,我为我的英语感到抱歉,我知道这并不完美,但我竭尽全力改进它。 :)

我目前正在使用 WPF 中的 telerik 框架。

这是代码(我不得不更改我的变量名称)

 <telerik:RadGridView Name="GridName" IsPropertyChangedAggregationEnabled="True" EnableColumnGroupsVirtualization="True" EnableColumnVirtualization="True" ItemsSource="{Binding PagedSource, ElementName=PagerName}" AutoGenerateColumns="False" IsBusy="{Binding IsLoading}" SelectedItem="{Binding SelectedIsinFromGrid}" Grid.Row="0">
                <telerik:RadGridView.Resources>
                    <Style TargetType="{x:Type telerik:GridViewRow}" BasedOn="{StaticResource {x:Type telerik:GridViewRow}}" >
                        <Style.Triggers>
                            <DataTrigger Binding="{Binding Status}" Value="ACTIVE">
                                <Setter Property="Background" Value="{StaticResource GreenRessourceColor}" />
                            </DataTrigger>
                            <DataTrigger Binding="{Binding Status}" Value="DISABLE">
                                <Setter Property="Background" Value="{StaticResource RedRessourceColor}" />
                            </DataTrigger>
                            <DataTrigger Binding="{Binding Status}" Value="UNKNOW">
                                <Setter Property="Background" Value="{StaticResource YellowRessourceColor}" />
                            </DataTrigger>
                        </Style.Triggers>
                    </Style>
                </telerik:RadGridView.Resources>
                <telerik:RadGridView.Columns>
                    <telerik:GridViewDataColumn Header="Header1" DataMemberBinding="{Binding Item1}" />
                    <telerik:GridViewDataColumn Header="Header2" DataMemberBinding="{Binding Item2}"/>
                    <telerik:GridViewDataColumn Header="Header3" DataMemberBinding="{Binding Item3}"/>
                    <telerik:GridViewDataColumn Header="Header4" DataMemberBinding="{Binding Status}"/>
                </telerik:RadGridView.Columns>
            </telerik:RadGridView>
            <telerik:RadDataPager Name="PagerName" Style="{StaticResource CustomDataPagerStyle}" Grid.Row="1" Source="{Binding ItemsListToDisplay}" PageSize="100" IsTotalItemCountFixed="False" />

错误:

System.Windows.Data Error: 4 : Cannot find source for binding with reference 'RelativeSource FindAncestor, AncestorType='Telerik.Windows.Controls.GridView.GridViewRow', AncestorLevel='1''. BindingExpression:Path=IsPinned; DataItem=null; target element is 'GridViewPinButton' (Name=''); target property is 'IsPinned' (type 'Boolean')

网格、寻呼机和数据以正确的颜色很好地显示,除了我的 VS 输出中有这个错误。

有关此代码用法的更多信息。

此代码在 UserControl 中使用,此 userControl 包装在 RadPane 中,然后注入到 RadPaneGroup 中。

我为什么要这样做?因为我正在使用棱镜将我的模块作为 RadPane

动态注入到 mainRegion 中

仅当我将窗格移出 RadPaneGroup 时才发生错误

好像我搞砸了 RadGridView styleRow。

如您所见,我没有直接使用 IsPinned 属性。

有什么想法吗?

我在 telerik 论坛上问了同样的问题。

简短的回答是:将 RadGridView 的 GroupRenderMode 设置为 Flat

更多详情:

将此问题记录为 Telerik UI WPF 错误。

要获取有关此错误的更多信息和代码以及如何重现它,请遵循此 link:Telerik Forum Binding error thread

关注错误报告:Bug report

telerik employ 的回答是:

I was able to successfully reproduce the error at my end and have thus logged a new bug report in our feedback portal to which you can subscribe in order to get notified about any changes in its status. As a gratitude for your help, I've awarded you with some Telerik points.

For the time being, you can set your RadGridView's GroupRenderMode to Flat in order to avoid these binding errors.

Regards, Dilyan Traykov Telerik by Progress