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

Exception on GridTemplate

3 Answers 124 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Armand
Top achievements
Rank 2
Armand asked on 08 Oct 2010, 11:01 AM
Hi every one on Telerik :P
Im getting a Exception Which is unknown to me and apparently Microsoft

Sinse i'm new to templating in WPF i'm not really sure what is hapening, I get this Exception "Provide value on 'System.Windows.Baml2006.DeferredBinaryDeserializerExtension' threw an exception." and the inner exception "Token is not valid."

Is there any reason why i would get this? Please help.

Here is my Stack Trace and Source Code.

   at System.Windows.Markup.XamlReader.RewrapException(Exception e, Uri baseUri)
   at System.Windows.FrameworkTemplate.LoadTemplateXaml(XamlReader templateReader, XamlObjectWriter currentWriter)
   at System.Windows.FrameworkTemplate.LoadTemplateXaml(XamlObjectWriter objectWriter)
   at System.Windows.FrameworkTemplate.LoadOptimizedTemplateContent(DependencyObject container, IComponentConnector componentConnector, IStyleConnector styleConnector, List`1 affectedChildren, UncommonField`1 templatedNonFeChildrenField)
   at System.Windows.FrameworkTemplate.LoadContent(DependencyObject container, List`1 affectedChildren)
   at System.Windows.StyleHelper.ApplyTemplateContent(UncommonField`1 dataField, DependencyObject container, FrameworkElementFactory templateRoot, Int32 lastChildIndex, HybridDictionary childIndexFromChildID, FrameworkTemplate frameworkTemplate)
   at System.Windows.FrameworkTemplate.ApplyTemplateContent(UncommonField`1 templateDataField, FrameworkElement container)
   at System.Windows.FrameworkElement.ApplyTemplate()
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at System.Windows.UIElement.Measure(Size availableSize)
   at Telerik.Windows.Controls.GridView.GridViewVirtualizingPanel.MeasureOverride(Size constraint) in c:\Builds\WPF_Scrum\Release_WPF_2010_Q2_SP2\Sources\Development\Controls\GridView\GridView\GridView\Virtualization\GridViewVirtualizingPanel.cs:line 1269

<Page x:Class="GridTest.Page1"
      mc:Ignorable="d" Title="SomePage"
      xmlns:controls="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.GridView" xmlns:my="clr-namespace:GridTest" xmlns:gridview="clr-namespace:Telerik.Windows.Controls.GridView;assembly=Telerik.Windows.Controls.GridView">
    <Page.Resources>
        <my:NorthwindOADataSet x:Key="northwindOADataSet" />
        <CollectionViewSource x:Key="employeesViewSource" Source="{Binding Path=Employees, Source={StaticResource northwindOADataSet}}" />
         
        <ControlTemplate x:Key="ImageCellTemplate" TargetType="{x:Type telerik:GridViewCell}">
            <Rectangle RadiusX="5" RadiusY="100" Height="100">
                <Rectangle.Fill>
                    <ImageBrush x:Name="brush" ImageSource="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Content}"></ImageBrush>
                </Rectangle.Fill>
            </Rectangle
        </ControlTemplate>
         
        <ControlTemplate x:Key="MyCustomRowTemplate" TargetType="{x:Type telerik:GridViewRow}">
            <Border Background="Transparent" Name="selectedRow" Margin="0" Opacity="1" BorderThickness="0,1,0,1" VerticalAlignment="Center">
                <Grid Width="400">
                    <Grid.RowDefinitions>
                        <RowDefinition Height="30"/>
                        <RowDefinition/>
                        <RowDefinition/>
                        <RowDefinition/>
                        <RowDefinition/>
                    </Grid.RowDefinitions>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="35"/>
                        <ColumnDefinition Width="120"/>
                        <ColumnDefinition Width="100"/>
                        <ColumnDefinition Width="*"/>
                    </Grid.ColumnDefinitions>
                    <Border Height="Auto" HorizontalAlignment="Left" Background="#FF233052" Margin="2,1,0,0" Width="400" BorderBrush="#FFFFFFFF" CornerRadius="5,5,5,5" BorderThickness="1" Grid.ColumnSpan="4">
                    </Border>
                    <Border Height="Auto" Grid.Row="1" HorizontalAlignment="Left" Background="#FF5E78BA" Margin="2,1,0,0" Width="400" BorderBrush="#FFFFFFFF" CornerRadius="5,5,5,5" BorderThickness="1" Grid.ColumnSpan="4" Grid.RowSpan="4">
                    </Border>
                     
                    <gridview:GridViewCell Grid.Row="0" Grid.Column="1" Foreground="#FFFFFFFF" Width="200" Margin="0,5,0,0" HorizontalAlignment="Left" Name="FirstName" TextBlock.FontSize="16" VerticalAlignment="Center"/>
 
                    <gridview:GridViewCell Grid.Row="0" Grid.Column="2" Grid.ColumnSpan="2" Foreground="#FFFFFFFF" Width="200" Margin="0,5,0,0" HorizontalAlignment="Left" Name="Title" TextBlock.FontSize="16" VerticalAlignment="Center" />
 
                    <gridview:GridViewCell Name="LastName" TextBlock.Foreground="#FFC4D2EF" Grid.Row="1" Grid.Column="0" Grid.RowSpan="3" Width="100" Margin="10,0,0,12">
                        <gridview:GridViewCell.LayoutTransform>
                            <TransformGroup>
                                <RotateTransform Angle="270"/>
                            </TransformGroup>
                        </gridview:GridViewCell.LayoutTransform>
                    </gridview:GridViewCell>
                     
                    <gridview:GridViewCell Name="Photo" HorizontalAlignment="Center" VerticalAlignment="Center" Template="{StaticResource ImageCellTemplate}" Margin="10,50,10,20" Grid.Column="1" Grid.Row="0" Grid.RowSpan="4"/>
                     
                    <Label Grid.Column="2" Foreground="FFC4D2EF" Grid.Row="1" Content="Street Address"/>
                    <Label Grid.Column="2" Foreground="FFC4D2EF" Grid.Row="2" Content="City:"/>
                    <Label Grid.Column="2" Foreground="FFC4D2EF" Grid.Row="3" Content="HomePhone:"/>
 
                    <gridview:GridViewCell Grid.Column="3" TextBlock.Foreground="#FFFFFFFF" Grid.Row="1" Name="Address">
                        <gridview:GridViewCell.Template>
                            <ControlTemplate>
                                <TextBlock TextWrapping="Wrap" Text="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Context}"/>
                            </ControlTemplate>
                        </gridview:GridViewCell.Template>
                    </gridview:GridViewCell>
 
                    <gridview:GridViewCell TextBlock.Foreground="#FFFFFFFF" Grid.Column="3" Grid.Row="2" Name="City"/>
                    <gridview:GridViewCell TextBlock.Foreground="#FFFFFFFF" Grid.Column="3" Grid.Row="3" Name="HomePhone"/>
                    <gridview:GridViewCell Grid.Column="1" Grid.ColumnSpan="3" Grid.Row="4" TextBlock.Foreground="#FFFFFFFF" Name="Notes">
                        <gridview:GridViewCell.Template>
                            <ControlTemplate>
                                <TextBlock TextWrapping="Wrap" Text="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Context}" />
                            </ControlTemplate>
                        </gridview:GridViewCell.Template>
                    </gridview:GridViewCell>
                     
                </Grid>
            </Border>
        </ControlTemplate>
         
        <Style TargetType="{x:Type gridview:GridViewRow}">
            <Setter Property="telerik:GridViewRow.Template" Value="{StaticResource MyCustomRowTemplate}"/>
        </Style>
         
    </Page.Resources>
    <Grid DataContext="{StaticResource employeesViewSource}">
        <controls:RadGridView HorizontalAlignment="Left" Name="radGridView1" VerticalAlignment="Top" ScrollMode="RealTime" IsReadOnly="True" AutoGenerateColumns="False" ItemsSource="{Binding}">
            <controls:RadGridView.Columns>
                <controls:GridViewDataColumn DataType="{x:Null}" UniqueName="EmployeeID" />
                <controls:GridViewDataColumn DataType="{x:Null}" UniqueName="LastName" />
                <controls:GridViewDataColumn DataType="{x:Null}" UniqueName="Photo" IsSortable="True" />
                <controls:GridViewDataColumn DataType="{x:Null}" UniqueName="Title" />
                <controls:GridViewDataColumn DataType="{x:Null}" UniqueName="City" />
                <controls:GridViewDataColumn DataType="{x:Null}" UniqueName="HomePhone" />
            </controls:RadGridView.Columns>
        </controls:RadGridView>
    </Grid>
</Page>
 
Source Code is not much
 
public Page1()
        {
            InitializeComponent();
 
            var dbdata = new NorthwindOADataSetTableAdapters.EmployeesTableAdapter();
            radGridView1.DataContext = dbdata.GetData();
        }

3 Answers, 1 is accepted

Sort by
0
Vlad
Telerik team
answered on 08 Oct 2010, 03:47 PM
Hello,

 Can you send us this application via support ticket? We will debug it locally and we will let you know about our findings. 

Sincerely yours,
Vlad
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Matt
Top achievements
Rank 2
answered on 26 Oct 2015, 08:51 PM

Was there ever an app submitted or a resolution found? I'm trying to template AutoHideArea and am encountering a similar issue:

 

Provide value on 'System.Windows.Baml2006.DeferredBinaryDeserializerExtension' threw an exception.

Token is not valid.

 

When overriding the RightTemplate.

0
Petya
Telerik team
answered on 29 Oct 2015, 04:16 PM
Hello Matt,

We didn't hear back from Armand and it looks like you're using RadDocking and not RadGridView. I'm not sure what exactly might be causing this, but would suggest you open a support ticket and send us the code so we can have a look.

Regards,
Petya
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
GridView
Asked by
Armand
Top achievements
Rank 2
Answers by
Vlad
Telerik team
Matt
Top achievements
Rank 2
Petya
Telerik team
Share this question
or