2016-09-27 61 views
0

你好SO社區找到來源:O)Telerik的RadGridView +風格+ RadDataPager =無法綁定IsPinned

首先,我爲我的英語很抱歉,我知道這是不是完美的,但我打破我回改進它。 :)

我目前正在使用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') 

電網,尋呼機及的數據都是很好用正確的顏色顯示, excepte,我有我的VS輸出內的這個錯誤。

有關此代碼的用法的更多信息。

此代碼用於UserControl內部,此用戶控件包裝在RadPane中,然後將其注入到RadPaneGroup中。

我爲什麼要這樣做?因爲我使用的棱鏡來注入我的飛行進入mainRegion模塊作爲RadPane

錯誤occure只有當我移動窗格中的RadPaneGroup

它就像我搞砸了與RadGridView styleRow之外。

如您所見,我沒有直接使用IsPinned屬性。

任何想法?

+0

這個特殊的錯誤對於telerik的WPF控件來說很常見,我多次看到它用於不同的控件,而不僅僅是尋呼機。我建議詢問他們對此的支持,或只是在他們的論壇上發表意見。 – Evk

+0

我剛剛做到了:) http://www.telerik.com/forums/telerik-radgridview-style-raddatapager-=-cannot-find-source-for-binding-ispinned#Fy0uMHy3cEmSz9FGtdUv5Q – pix

回答

0

我在telerik論壇上問過同樣的問題。

簡短的回答是:設置你的RadGridView的GroupRenderMode到扁平

更多細節:

記錄的這個問題作爲一個Telerik的UI WPF的bug。

要獲得有關此錯誤的詳細信息和代碼以及如何reproduice它請點擊此鏈接:Telerik Forum Binding error thread

遵循錯誤報告:Bug report

由Telerik的聘用問題作出的回答是:

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