Docs: Exception: Cannot find resource named 'nameItemTemplate'. Resource names are case sensitive.

Created on 1 Sep 2018  Â·  2Comments  Â·  Source: dotnet/docs

Hello,

On last build & launch, I get the following exception:

System.Windows.Markup.XamlParseException: ''Provide value on 'System.Windows.StaticResourceExtension' threw an exception.' Line number '38' and line position '55'.'

Exception: Cannot find resource named 'nameItemTemplate'. Resource names are case sensitive.

nameItemTemplate is found in two places within solution

1)
ItemsSource="{Binding Source={StaticResource ExpenseDataSource}, XPath=Person}"
ItemTemplate="{StaticResource nameItemTemplate}">

2)

       <!-- Name item template -->
        <DataTemplate x:Key="nameItemTemplate">
            <Label Content="{Binding XPath=@Name}"/>
        </DataTemplate>

Both within ExpenseITHome.xaml

The exception points to ExpenseITHome.xaml.cs, line 25, which reads

   public ExpenseITHome()
    {
        InitializeComponent();  // This is line 25
    }

Commenting out InitializeComponent(); makes the application work. Is there a point in the tutorial where this Initialize line is changed/removed? Did I just miss it? Why does the error occur?

As a side note: I really don't like editing lines and lines of axml code, readability is poor, structuring is poor etc. I am hoping that I can build these in Designer (or in Blend) and the code the main operation to .cs.

Thanks,

Tapio Valli


Document Details

⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

Most helpful comment

Make sure the section is the first item under , or at least before any of the controls on the grid.

All 2 comments

Make sure the section is the first item under , or at least before any of the controls on the grid.

great! it really works

Was this page helpful?
0 / 5 - 0 ratings

Related issues

sime3000 picture sime3000  Â·  3Comments

skylerberg picture skylerberg  Â·  3Comments

garfbradaz picture garfbradaz  Â·  3Comments

ite-klass picture ite-klass  Â·  3Comments

stjepan picture stjepan  Â·  3Comments