locked
The attachable property cell template was not found in type DataGridTemplate Column RRS feed

  • Question

  • Hi,

    I am getting the error "The attachable property cell template was not found in type DataGridTemplate Column", how can I remove this error. Error part is marked as bold.

    <UserControl x:Class="Test.MainPage" xmlns ="http://schemas.microsoft.com/winfx/2006/xaml/presentation"

    xmlns:x ="http://schemas.microsoft.com/winfx/2006/xaml"

    xmlns:d ="http://schemas.microsoft.com/expression/blend/2008"

    xmlns:mc ="http://schemas.openxmlformats.org/markup-compatibility/2006"

    mc:Ignorable="d" xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk" d:DesignHeight="643" d:DesignWidth="700" Loaded ="UserControl_Loaded">

    <Grid x:Name="LayoutRoot"Background ="White">

    <sdk:Label Height="28" HorizontalAlignment="Left" Margin="76,25,0,0" Name="label1" VerticalAlignment="Top" Content="Label"Width ="120" />

    <sdk:DataGrid AutoGenerateColumns="False" Height="40" HorizontalAlignment="Left" Margin="44,59,0,0" Name="GrdNew" VerticalAlignment="Top"Width ="250" >

    <sdk:DataGrid.Columns>

    <sdk:DataGridTemplateColumn Header="Id" CanUserResize="True" CanUserSort="True" Width="*"></sdk:DataGridTemplateColumn>

    <sdk:DataGridTemplateColumn.CellTemplate>

    <Datatemplate>

    <TextBlock x:Name="tbId"ScrollViewer.VerticalScrollBarVisibility="Auto">

    <sdk:Label Name="lblId" Content="Id"></sdk:Label>

    </TextBlock>

    </Datatemplate>

    </sdk:DataGridTemplateColumn.CellTemplate>

    <sdk:DataGridTemplateColumn Header="Name" CanUserResize="True" CanUserSort="True" Width="*"></sdk:DataGridTemplateColumn>

    <sdk:DataGridTemplateColumn Header="Address" CanUserResize="True" CanUserSort="True" Width="*"></sdk:DataGridTemplateColumn>

    </sdk:DataGrid.Columns>

    </sdk:DataGrid>

    </Grid>

    </UserControl>

    Wednesday, October 12, 2011 2:13 PM

Answers

  • Hi,

    You should put the </sdk:DataGridTemplateColumn> tag after CellTemplate property:

    <sdk:DataGridTemplateColumn Header="Id" CanUserResize="True" CanUserSort="True" Width="*">
        <sdk:DataGridTemplateColumn.CellTemplate>
            <Datatemplate>
                ...
            </Datatemplate>
        </sdk:DataGridTemplateColumn.CellTemplate>
    </sdk:DataGridTemplateColumn>
    Wednesday, October 12, 2011 7:07 PM

All replies

  • Hi,

    You should put the </sdk:DataGridTemplateColumn> tag after CellTemplate property:

    <sdk:DataGridTemplateColumn Header="Id" CanUserResize="True" CanUserSort="True" Width="*">
        <sdk:DataGridTemplateColumn.CellTemplate>
            <Datatemplate>
                ...
            </Datatemplate>
        </sdk:DataGridTemplateColumn.CellTemplate>
    </sdk:DataGridTemplateColumn>
    Wednesday, October 12, 2011 7:07 PM
  • Thanks for the solution.

    Thursday, October 13, 2011 6:01 AM