This is a migrated thread and some comments may be shown as answers.

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

17 Answers 583 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Mathieu
Top achievements
Rank 1
Mathieu asked on 27 Sep 2016, 01:02 PM

Hello telerik community :o)

First of all, I am sorry for my english, I know this is not perfect, but I break my back to improve it. :)

I am currently working with the telerik Framework in WPF.

Here is the code (I had to change my variables name)

 <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" />

The error:

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')

The grid, the pager and the datas are well displayed with the right color, excepte that I have this error inside my VS output.

More information about the usage of this code.

This code is used inside a UserControl, this userControl is wrapped inside a RadPane then it is injected into a RadPaneGroup.

Why am I doing this? Because I am using prism to inject my modules on the fly into the mainRegion as a RadPane

The error occure only when I am moving the pane outside the RadPaneGroup

It is like I messed up with the RadGridView styleRow.

As you can see, I am not using directly the IsPinned property.

Any Idea?

17 Answers, 1 is accepted

Sort by
0
Mathieu
Top achievements
Rank 1
answered on 27 Sep 2016, 01:03 PM
0
Dilyan Traykov
Telerik team
answered on 29 Sep 2016, 08:41 AM
Hello Mathieu,

I'm unsure about the exact reason why you're getting this binding error but what I can suggest, based on the code you provided, is to use RadGridView's RowStyleSelector property in order to conditionally style its rows and see whether this solves your issue.

Regards,
Dilyan Traykov
Telerik by Progress
Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
0
Mathieu
Top achievements
Rank 1
answered on 29 Sep 2016, 09:00 AM

I will use the RowStyleSelector, but this is not the probleme, because if I remove my xaml code related to the row color, the binding error is also raised.

I am also using a custom style on my raddatapager to add a dynamic datapager.

 

 

<Style x:Key="CustomRadDataPagerStyle" TargetType="{x:Type telerikPresentation:RadDataPager}" basedOn={staticRessource RadDataPagerStyle}>

 <Setter Property="Template" Value="{StaticResource RadDataPagerTemplate}"/>

<Setter Property="HorizontalContentAlignment" Value="Stretch"/>

<Setter Property="VerticalContentAlignment" Value="Center"/>

<Setter Property="Background" Value="{StaticResource RadPager_Background}"/>

<Setter Property="BorderBrush" Value="{StaticResource RadPager_Border}"/>

<Setter Property="BorderThickness" Value="1"/>

<Setter Property="Foreground" Value="{StaticResource RadPager_Foreground}"/>

<Setter Property="NumericButtonStyle" Value="{StaticResource RadPageStyle}"/>

<Setter Property="Height" Value="28"/>

<Setter Property="FontSize" Value="9"/>

</Style>

 

Do you think that issue can comme from this style? If yes, I do not get why...

0
Dilyan Traykov
Telerik team
answered on 29 Sep 2016, 09:42 AM
Hello Mathieu,

I do not believe the aforementioned style is the cause of this binding error. However, without being able to reproduce it at my end, I'm afraid I cannot guide you further in finding a solution.

May I also ask if this binding error is causing any undesired behavior in your application, or if you're just concerned about its origin?

Regards,
Dilyan Traykov
Telerik by Progress
Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
0
Mathieu
Top achievements
Rank 1
answered on 29 Sep 2016, 09:54 AM

Hello,

We are really concerned about the origin, Imagine that one of our developper is doing the samething on his own code, the console is so flooded by this messages, that we can not see it.

We can not even use the WpfBindingErrors library, because the application throw an exception from the Telerik Library and not directly from our code.

BindingExceptionThrower.Attach();

We all know that binding exceptions are so easy to rise. So that we do not want to have a single one! :)

0
Mathieu
Top achievements
Rank 1
answered on 29 Sep 2016, 09:59 AM

the error is also raised when I click the next button >> on the raddatapger.

I changed my code to use the StyleSelector, I have the same binding error.

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')
0
Dilyan Traykov
Telerik team
answered on 29 Sep 2016, 11:13 AM
Hello Mathieu,

I'm afraid that I am still unable to reproduce the binding error at my end. I'm attaching the sample project I've used to my reply. Could you please have a look at it and let me know if there's some way I can modify it so that it demonstrates the error?

If you're unable to do so, would it be possible for you to isolate this in a sample project and provide a download link so that I may further assist you with this?

Thank you in advance for your cooperation on the matter.

Regards,
Dilyan Traykov
Telerik by Progress
Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
0
Mathieu
Top achievements
Rank 1
answered on 29 Sep 2016, 11:51 AM

I added the ddl your project, but the main window remains blanc.

 

I will try to create a sample project for you.

0
Mathieu
Top achievements
Rank 1
answered on 29 Sep 2016, 11:53 AM
Sorry do not take this message into account.
0
Mathieu
Top achievements
Rank 1
answered on 29 Sep 2016, 11:55 AM
If I move the tab and put it back into the mainWindow I have this error:
System.Windows.Data Warning: 4 : Cannot find source for binding with reference 'ElementName=DropDownButtonElement'. BindingExpression:Path=IsChecked; DataItem=null; target element is 'DropDownMenu' (Name='DropDownMenuElement'); target property is 'IsOpen' (type 'Boolean')
0
Mathieu
Top achievements
Rank 1
answered on 29 Sep 2016, 11:59 AM

All the references come from :

C:\Program Files (x86)\Telerik\UI for WPF Q2 2016\Binaries\WPF45\
The style dll from:

C:\Program Files (x86)\Telerik\UI for WPF Q2 2016\Binaries.NoXaml\WPF45\Telerik.Windows.Themes.VisualStudio2013.dll

Any Idea?

0
Mathieu
Top achievements
Rank 1
answered on 29 Sep 2016, 12:13 PM
How can I add a zip?
Allowed extensions: .gif, .jpg, .jpeg, .png
0
Mathieu
Top achievements
Rank 1
answered on 29 Sep 2016, 12:14 PM

Please rename the file as .zip instead of gif.

The zip file contains your project, with my modifications and the binding error.

BTW I think you should have a review about your upload security.

0
Dilyan Traykov
Telerik team
answered on 29 Sep 2016, 12:27 PM
Hello Mathieu,

Unfortunately, I'm unable to download the file you provided. What I had in mind was for you to upload the project to a cloud storage provider such as Dropbox or Google Drive, for example, and provide a link for download as, currently, only image files can be uploaded to the forums.

Regards,
Dilyan Traykov
Telerik by Progress
Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
0
Mathieu
Top achievements
Rank 1
answered on 29 Sep 2016, 12:38 PM

I can not upload on a cloud storage.
Add a Dictionnary.xaml to your solution

Inside:

<ResourceDictionary
    xmlns:telerikPresentation="http://schemas.telerik.com/2008/xaml/presentation"
    xmlns:controls="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls"
    xmlns:converter="clr-namespace:XamlParseExceptionIsPinned.Converters"
    xmlns:dataPager="clr-namespace:Telerik.Windows.Controls.Data.DataPager;assembly=Telerik.Windows.Controls.Data">
 
    <ResourceDictionary.MergedDictionaries>
        <!-- Telerik.Windows.Controls is used by all assemblies -->
        <ResourceDictionary Source="/Telerik.Windows.Themes.VisualStudio2013;component/Themes/System.Windows.xaml" />
        <ResourceDictionary Source="/Telerik.Windows.Themes.VisualStudio2013;component/Themes/Telerik.Windows.Controls.xaml" />
        <ResourceDictionary Source="/Telerik.Windows.Themes.VisualStudio2013;component/Themes/Telerik.Windows.Controls.Input.xaml" />
        <!-- Requires: System.Windows.xaml -->
        <ResourceDictionary Source="/Telerik.Windows.Themes.VisualStudio2013;component/Themes/Telerik.Windows.Controls.Navigation.xaml" />
        <ResourceDictionary Source="/Telerik.Windows.Themes.VisualStudio2013;component/Themes/Telerik.Windows.Controls.Chart.xaml" />
        <!-- Requires: Telerik.Windows.Controls.Input -->
        <ResourceDictionary Source="/Telerik.Windows.Themes.VisualStudio2013;component/Themes/Telerik.Windows.Controls.Data.xaml" />
        <!--<ResourceDictionary Source="/Telerik.Windows.Themes.VisualStudio2013;component/Themes/Telerik.Windows.Controls.DataVisualization.xaml" />-->
        <!-- Requires: Telerik.Windows.Controls.Navigation -->
        <ResourceDictionary Source="/Telerik.Windows.Themes.VisualStudio2013;component/Themes/Telerik.Windows.Controls.Docking.xaml" />
        <ResourceDictionary Source="/Telerik.Windows.Themes.VisualStudio2013;component/Themes/Telerik.Windows.Controls.Expressions.xaml" />
        <ResourceDictionary Source="/Telerik.Windows.Themes.VisualStudio2013;component/Themes/Telerik.Windows.Controls.GridView.xaml" />
        <ResourceDictionary Source="/Telerik.Windows.Themes.VisualStudio2013;component/Themes/Telerik.Windows.Controls.RibbonView.xaml" />
        <ResourceDictionary Source="/Telerik.Windows.Themes.VisualStudio2013;component/Themes/Telerik.Windows.Documents.xaml" />
    </ResourceDictionary.MergedDictionaries>
    <converter:DataPagerConverter x:Key="DataPagerConverter" />
    <!-- End Brush -->
     
    <!-- Style -->
    <SolidColorBrush x:Key="RadPagerIndicator" Color="Black"/>
    <LinearGradientBrush x:Key="RadPagerNumericPresenterBorder" EndPoint="0.5,1" StartPoint="0.5,0">
        <GradientStop Color="#FF494949" Offset="0"/>
        <GradientStop Color="#FF9D9D9D" Offset="1"/>
    </LinearGradientBrush>
    <SolidColorBrush x:Key="RadPagerNumericPresenterBackground" Color="#FF929292"/>
    <SolidColorBrush x:Key="RadPagerSeparator1" Color="White"/>
    <SolidColorBrush x:Key="RadPagerSeparator2" Color="#FF848484"/>
    <ControlTemplate x:Key="DataPagerPresenterTemplate" TargetType="{x:Type dataPager:DataPagerPresenter}">
        <Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}">
            <Grid HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="*"/>
                    <ColumnDefinition Width="Auto"/>
                </Grid.ColumnDefinitions>
                <StackPanel HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Orientation="Horizontal" VerticalAlignment="{TemplateBinding VerticalContentAlignment}">
                    <controls:RadButton x:Name="MoveToFirstPageButton" Command="telerikPresentation:RadDataPagerCommands.MoveToFirstPage" Height="18" Margin="2"  Visibility="{Binding PagerControlsVisibility.MoveToFirstPageControlVisibility, RelativeSource={RelativeSource TemplatedParent}}" Width="18">
                        <StackPanel Orientation="Horizontal">
                            <Rectangle Fill="{StaticResource RadPagerIndicator}" HorizontalAlignment="Center" Height="7" VerticalAlignment="Center" Width="1"/>
                            <Path Data="M0,0 L3.5,3.5 0,7 Z" Fill="{StaticResource RadPagerIndicator}" HorizontalAlignment="Center" Height="7" RenderTransformOrigin="0.5, 0.5" VerticalAlignment="Center" Width="4">
                                <Path.RenderTransform>
                                    <TransformGroup>
                                        <ScaleTransform ScaleY="1" ScaleX="-1"/>
                                        <SkewTransform AngleY="0" AngleX="0"/>
                                        <RotateTransform Angle="0"/>
                                        <TranslateTransform/>
                                    </TransformGroup>
                                </Path.RenderTransform>
                            </Path>
                        </StackPanel>
                    </controls:RadButton>
                    <controls:RadButton x:Name="MoveToPreviousPageButton" Command="telerikPresentation:RadDataPagerCommands.MoveToPreviousPage" Height="18" Margin="2"  Visibility="{Binding PagerControlsVisibility.MoveToPreviousPageControlVisibility, RelativeSource={RelativeSource TemplatedParent}}" Width="18">
                        <Path Data="M0,0 L3.5,3.5 0,7 Z" Fill="{StaticResource RadPagerIndicator}" HorizontalAlignment="Center" Height="7" RenderTransformOrigin="0.5, 0.5" VerticalAlignment="Center" Width="4">
                            <Path.RenderTransform>
                                <TransformGroup>
                                    <ScaleTransform ScaleY="1" ScaleX="-1"/>
                                    <SkewTransform AngleY="0" AngleX="0"/>
                                    <RotateTransform Angle="0"/>
                                    <TranslateTransform/>
                                </TransformGroup>
                            </Path.RenderTransform>
                        </Path>
                    </controls:RadButton>
                    <Border BorderBrush="{StaticResource RadPagerNumericPresenterBorder}" BorderThickness="1,0,0,0" Background="{StaticResource RadPagerNumericPresenterBackground}" Height="20" Visibility="{Binding PagerControlsVisibility.NumericElementsControlVisibility, RelativeSource={RelativeSource TemplatedParent}}" VerticalAlignment="Center">
                        <dataPager:NumericElementsPresenter AutoEllipsisMode="{TemplateBinding AutoEllipsisMode}" NumericButtonStyle="{TemplateBinding NumericButtonStyle}" NumericButtonCount="{TemplateBinding NumericButtonCount}" PageCount="{TemplateBinding PageCount}" PageIndex="{TemplateBinding PageIndex}" />
                    </Border>
                    <controls:RadButton x:Name="MoveToNextPageButton" Command="telerikPresentation:RadDataPagerCommands.MoveToNextPage" Height="18" Margin="2"  Visibility="{Binding PagerControlsVisibility.MoveToNextPageControlVisibility, RelativeSource={RelativeSource TemplatedParent}}" Width="18">
                        <Path Data="M0,0 L3.5,3.5 0,7 Z" Fill="{StaticResource RadPagerIndicator}" HorizontalAlignment="Center" Height="7" VerticalAlignment="Center" Width="4"/>
                    </controls:RadButton>
                    <controls:RadButton x:Name="MoveToLastPageButton" Command="telerikPresentation:RadDataPagerCommands.MoveToLastPage" Height="18" Margin="2"  Visibility="{Binding PagerControlsVisibility.MoveToLastPageControlVisibility, RelativeSource={RelativeSource TemplatedParent}}" Width="18">
                        <StackPanel Orientation="Horizontal">
                            <Path Data="M0,0 L3.5,3.5 0,7 Z" Fill="{StaticResource RadPagerIndicator}" HorizontalAlignment="Center" Height="7" VerticalAlignment="Center" Width="4"/>
                            <Rectangle Fill="{StaticResource RadPagerIndicator}" HorizontalAlignment="Center" Height="7" VerticalAlignment="Center" Width="1"/>
                        </StackPanel>
                    </controls:RadButton>
                </StackPanel>
                <StackPanel Grid.Column="1" Margin="5,0" Orientation="Horizontal" Visibility="{Binding PagerControlsVisibility.TextControlVisibility, RelativeSource={RelativeSource TemplatedParent}}">
                    <telerikPresentation:RadComboBox ItemsSource="{Binding Converter={StaticResource DataPagerConverter}, Path=ItemCount, UpdateSourceTrigger=PropertyChanged, RelativeSource={RelativeSource TemplatedParent}}"
                        SelectedValue="{Binding PageSize, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"
                        x:Name="radComboBox"/>
                    <Border Background="{StaticResource RadPagerSeparator1}" HorizontalAlignment="Left" Height="18" Margin="5,0,0,0" VerticalAlignment="Center" Width="1"/>
                    <Border Background="{StaticResource RadPagerSeparator2}" HorizontalAlignment="Left" Height="18" Margin="0,0,10,0" VerticalAlignment="Center" Width="1"/>
                    <TextBlock Margin="2,0" controls:LocalizationManager.ResourceKey="RadDataPagerPage" VerticalAlignment="Center"/>
                    <dataPager:DataPagerTextBox Command="telerikPresentation:RadDataPagerCommands.MoveToPage" Height="20" Margin="2,0" PageIndex="{TemplateBinding PageIndex}"  VerticalAlignment="Center" Width="48"/>
                    <TextBlock Margin="2,0" controls:LocalizationManager.ResourceKey="RadDataPagerOf" VerticalAlignment="Center"/>
                    <TextBlock Margin="2,0" Text="{Binding PageCount, RelativeSource={RelativeSource TemplatedParent}}" VerticalAlignment="Center"/>
                </StackPanel>
            </Grid>
        </Border>
    </ControlTemplate>
    <Style x:Key="CustomDataPagerPresenterStyle" TargetType="{x:Type dataPager:DataPagerPresenter}" BasedOn="{StaticResource DataPagerPresenterStyle}">
        <Setter Property="Template" Value="{StaticResource DataPagerPresenterTemplate}"/>
    </Style>
    <ControlTemplate x:Key="RadDataPagerTemplate" TargetType="{x:Type telerikPresentation:RadDataPager}">
        <dataPager:DataPagerPresenter AutoEllipsisMode="{TemplateBinding AutoEllipsisMode}"
                                      BorderBrush="{TemplateBinding BorderBrush}"
                                      BorderThickness="{TemplateBinding BorderThickness}"
                                      Background="{TemplateBinding Background}"
                                      DisplayMode="{TemplateBinding DisplayMode}"
                                      HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
                                      ItemCount="{Binding ItemCount, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"
                                      NumericButtonStyle="{TemplateBinding NumericButtonStyle}"
                                      NumericButtonCount="{TemplateBinding NumericButtonCount}"
                                      PageCount="{TemplateBinding PageCount}"
                                      PageSize="{Binding PageSize, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"
                                      PageIndex="{TemplateBinding PageIndex}"
                                      VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
                                      Style="{StaticResource CustomDataPagerPresenterStyle}"/>
    </ControlTemplate>
    <LinearGradientBrush x:Key="RadPager_Background" EndPoint="0.5,1" StartPoint="0.5,0">
        <GradientStop Color="#FFB5B5B5"/>
        <GradientStop Color="#FFF0F0F0" Offset="0.5"/>
    </LinearGradientBrush>
    <SolidColorBrush x:Key="RadPager_Border" Color="#FF848484"/>
    <SolidColorBrush x:Key="RadPager_Foreground" Color="Black"/>
    <LinearGradientBrush x:Key="RadPager_Page_TopShadow" EndPoint="0.5,1" StartPoint="0.5,0">
        <GradientStop Color="#66000000" Offset="0"/>
        <GradientStop Offset="0.3"/>
    </LinearGradientBrush>
    <LinearGradientBrush x:Key="RadPager_Page_Over" EndPoint="0.5,0.99" StartPoint="0.5,0.01">
        <GradientStop Color="#FFFFFBB7" Offset="0.216"/>
        <GradientStop Color="#FFBDBDBD"/>
    </LinearGradientBrush>
    <LinearGradientBrush x:Key="RadPager_Page_Checked" EndPoint="0.5,0.99" StartPoint="0.5,0.01">
        <GradientStop Color="#FFFFDB7B" Offset="0.5"/>
        <GradientStop Color="#FFC58124"/>
    </LinearGradientBrush>
    <LinearGradientBrush x:Key="RadPager_Page_Disabled" EndPoint="0.5,0.99" StartPoint="0.5,0.01">
        <GradientStop Color="#FFD8D8D8" Offset="0.216"/>
        <GradientStop Color="#FFBDBDBD"/>
    </LinearGradientBrush>
    <ControlTemplate x:Key="RadPageTemplate" TargetType="{x:Type controls:RadRadioButton}">
        <Border x:Name="PageButton" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" CornerRadius="0,0,6,1">
            <VisualStateManager.VisualStateGroups>
                <VisualStateGroup x:Name="CommonStates">
                    <VisualState x:Name="Normal"/>
                    <VisualState x:Name="MouseOver">
                        <Storyboard>
                            <ObjectAnimationUsingKeyFrames BeginTime="0" Storyboard.TargetProperty="Background" Storyboard.TargetName="PageButton">
                                <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource RadPager_Page_Over}"/>
                            </ObjectAnimationUsingKeyFrames>
                        </Storyboard>
                    </VisualState>
                    <VisualState x:Name="Pressed">
                        <Storyboard>
                            <ObjectAnimationUsingKeyFrames BeginTime="0" Storyboard.TargetProperty="Background" Storyboard.TargetName="PageButton">
                                <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource RadPager_Page_Checked}"/>
                            </ObjectAnimationUsingKeyFrames>
                        </Storyboard>
                    </VisualState>
                    <VisualState x:Name="Disabled">
                        <Storyboard>
                            <ObjectAnimationUsingKeyFrames BeginTime="0" Storyboard.TargetProperty="Background" Storyboard.TargetName="PageButton">
                                <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource RadPager_Page_Disabled}"/>
                            </ObjectAnimationUsingKeyFrames>
                        </Storyboard>
                    </VisualState>
                    <VisualState x:Name="Checked">
                        <Storyboard>
                            <ObjectAnimationUsingKeyFrames BeginTime="0" Storyboard.TargetProperty="Background" Storyboard.TargetName="PageButton">
                                <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource RadPager_Page_Checked}"/>
                            </ObjectAnimationUsingKeyFrames>
                        </Storyboard>
                    </VisualState>
                </VisualStateGroup>
                <VisualStateGroup x:Name="FocuseStatesGroup">
                    <VisualState x:Name="Unfocused"/>
                    <VisualState x:Name="Focused">
                        <Storyboard>
                            <ObjectAnimationUsingKeyFrames BeginTime="0" Storyboard.TargetProperty="Background" Storyboard.TargetName="PageButton">
                                <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource RadPager_Page_Over}"/>
                            </ObjectAnimationUsingKeyFrames>
                        </Storyboard>
                    </VisualState>
                </VisualStateGroup>
            </VisualStateManager.VisualStateGroups>
            <Border Background="{StaticResource RadPager_Page_TopShadow}">
                <ContentControl Content="{TemplateBinding Content}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" IsTabStop="False" Margin="{TemplateBinding Padding}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
            </Border>
        </Border>
    </ControlTemplate>
    <LinearGradientBrush x:Key="RadPager_Page_Background" EndPoint="0.5,1" StartPoint="0.5,0">
        <GradientStop Color="White" Offset="0.216"/>
        <GradientStop Color="#FFBDBDBD"/>
    </LinearGradientBrush>
    <LinearGradientBrush x:Key="RadPager_Page_Border" EndPoint="0.5,1" StartPoint="0.5,0">
        <GradientStop Color="#FF494949" Offset="0"/>
        <GradientStop Color="#FF9D9D9D" Offset="1"/>
    </LinearGradientBrush>
    <Style x:Key="RadPageStyle" TargetType="{x:Type controls:RadRadioButton}">
        <Setter Property="Template" Value="{StaticResource RadPageTemplate}"/>
        <Setter Property="Background" Value="{StaticResource RadPager_Page_Background}"/>
        <Setter Property="BorderBrush" Value="{StaticResource RadPager_Page_Border}"/>
        <Setter Property="BorderThickness" Value="0,0,1,1"/>
        <Setter Property="MinWidth" Value="21"/>
        <Setter Property="HorizontalContentAlignment" Value="Center"/>
        <Setter Property="VerticalContentAlignment" Value="Center"/>
        <Setter Property="Padding" Value="0"/>
    </Style>
    <Style x:Key="CustomRadDataPagerStyle" TargetType="{x:Type telerikPresentation:RadDataPager}" BasedOn="{StaticResource RadDataPagerStyle}">
        <Setter Property="Template" Value="{StaticResource RadDataPagerTemplate}"/>
        <Setter Property="HorizontalContentAlignment" Value="Stretch"/>
        <Setter Property="VerticalContentAlignment" Value="Center"/>
        <Setter Property="Background" Value="{StaticResource RadPager_Background}"/>
        <Setter Property="BorderBrush" Value="{StaticResource RadPager_Border}"/>
        <Setter Property="BorderThickness" Value="1"/>
        <Setter Property="Foreground" Value="{StaticResource RadPager_Foreground}"/>
        <Setter Property="NumericButtonStyle" Value="{StaticResource RadPageStyle}"/>
        <Setter Property="Height" Value="28"/>
        <Setter Property="FontSize" Value="9"/>
    </Style>
</ResourceDictionary>

Add Folder Converters inside the solution.Then inside this folder add a new Class as follow:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
 
namespace XamlParseExceptionIsPinned.Converters
{
    using System.Windows.Data;
 
    public class DataPagerConverter : IValueConverter
    {
        private const int PAGERSIZE = 10;
 
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            var result = new List<int>();
            var totalItem = (int)value;
            if (totalItem <= 0)
            {
                return 0;
            }
 
            for (var i = 0; i <= totalItem; ++i)
            {
                if ((i % PAGERSIZE) == 0 && i > 0)
                {
                    result.Add(i);
                }
            }
 
            return result;
        }
 
        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            return value;
        }
    }
}

Then change your GridViewUserControl.xaml as follow:

<UserControl x:Class="XamlParseExceptionIsPinned.GridViewUserControl"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
             mc:Ignorable="d"
             d:DesignHeight="300" d:DesignWidth="300">
    <Grid>
        <Grid.Resources>
            <ResourceDictionary>
                    <ResourceDictionary.MergedDictionaries>
                    <ResourceDictionary Source="/XamlParseExceptionIsPinned;component/Dictionary.xaml"/>
                    </ResourceDictionary.MergedDictionaries>
                </ResourceDictionary>
        </Grid.Resources>
        <Grid.RowDefinitions>
            <RowDefinition Height="*" />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>
        <telerik:RadGridView x:Name="clubsGrid"
                             ItemsSource="{Binding PagedSource, ElementName=PagerName}"
                             IsPropertyChangedAggregationEnabled="True"
                             EnableColumnGroupsVirtualization="True"
                             EnableColumnVirtualization="True"
                             AutoGenerateColumns="False"
                             SelectedItem="{Binding SelectedItem}"
                             Grid.Row="0">
            <telerik:RadGridView.Columns>
                <telerik:GridViewDataColumn ShowDistinctFilters="False" DataMemberBinding="{Binding Name}"/>
                <telerik:GridViewDataColumn DataMemberBinding="{Binding Established}"
                                            Header="Est."
                                            DataFormatString="{}{0:yyyy}"/>
                <telerik:GridViewDataColumn DataMemberBinding="{Binding StadiumCapacity}"
                                            Header="Stadium"
                                            DataFormatString="{}{0:N0}"/>
            </telerik:RadGridView.Columns>
        </telerik:RadGridView>
        <telerik:RadDataPager Style="{StaticResource CustomRadDataPagerStyle}" Name="PagerName" Grid.Row="1" Source="{Binding Clubs}" PageSize="10" IsTotalItemCountFixed="False" />
    </Grid>
</UserControl>

0
Mathieu
Top achievements
Rank 1
answered on 29 Sep 2016, 03:10 PM

I am not a telerik expert, but I think I just found something in the Teleril.Windows.Controls.GridView.Xaml

What about the RelativeSource AncestorType={x:Type grid:GridViewRow} ? it looks like the AncestorType is lost during the tab drag&drop.

 

<Style x:Key="GridViewPinButtonStyle" TargetType="grid:GridViewPinButton">
        <Setter Property="PathStyle" Value="{StaticResource UnpinnedButtonStyle}"/>
        <Setter Property="PathGeometry" Value="M4,2 L4,3 L8,3 L8,2 z M3,0 L4,0 L4,1 L8,1 L9,1 L9,2 L9,3 L9,6 L8,6 L4,6 L4,7 L3,7 L3,6 L3,4 L0,4 L0,3 L3,3 L3,2 L3,1 z"/>
        <Setter Property="MinHeight" Value="20"/>
        <Setter Property="MinWidth" Value="23"/>
        <Setter Property="IsBackgroundVisible" Value="False"/>
        <Setter Property="Command" Value="{x:Static telerik:RadGridViewCommands.TogglePinnedRowState}"/>
        <Setter Property="CommandParameter" Value="{Binding}"/>
        <Setter Property="IsPinned" Value="{Binding IsPinned, RelativeSource={RelativeSource AncestorType={x:Type grid:GridViewRow}}}"/>
        <Setter Property="SnapsToDevicePixels" Value="True"/>
        <Setter Property="BorderThickness" Value="1"/>
        <Setter Property="HorizontalContentAlignment" Value="Stretch"/>
        <Setter Property="VerticalContentAlignment" Value="Stretch"/>
        <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
        <Setter Property="IsTabStop" Value="False"/>
        <Setter Property="Padding" Value="0"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="telerik:RadPathButton">
                    <Grid Background="Transparent">
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="BackgroundVisibility">
                                <VisualState x:Name="BackgroundIsHidden">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="OuterBorder" Storyboard.TargetProperty="Visibility">
                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Visibility>Collapsed</Visibility>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="BackgroundIsVisible"/>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <Border x:Name="OuterBorder"
                                BorderThickness="{TemplateBinding BorderThickness}"
                                BorderBrush="{TemplateBinding BorderBrush}"
                                Background="{TemplateBinding Background}"
                                CornerRadius="{TemplateBinding CornerRadius}"/>
                        <Grid Margin="{TemplateBinding Padding}">
                            <Path x:Name="Path" Style="{TemplateBinding PathStyle}" Data="{TemplateBinding PathGeometry}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
                        </Grid>
                    </Grid>
                    <ControlTemplate.Triggers>
                        <DataTrigger Binding="{Binding IsSelected, RelativeSource={RelativeSource AncestorType={x:Type grid:GridViewRow}}}" Value="True">
                            <Setter TargetName="Path" Property="Fill" Value="{telerik:VisualStudio2013Resource ResourceKey=SelectedBrush}"/>
                        </DataTrigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Style.Triggers>
            <Trigger Property="IsPinned" Value="True">
                <Setter Property="PathGeometry" Value="M2,1L2,5L3,5L3,1zM3,0L6,0L6,1L6,5L7,5L7,6L4,6L4,9L3,9L3,6L2,6L1,6L0,6L0,5L1,5L1,1L1,1e-006L2,1e-006z"/>
                <Setter Property="PathStyle" Value="{StaticResource PinnedButtonStyle}"/>
            </Trigger>
        </Style.Triggers>
    </Style>

0
Dilyan Traykov
Telerik team
answered on 29 Sep 2016, 03:37 PM
Hello Mathieu,

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
Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
Tags
GridView
Asked by
Mathieu
Top achievements
Rank 1
Answers by
Mathieu
Top achievements
Rank 1
Dilyan Traykov
Telerik team
Share this question
or