Problem with binding to DataTemplate

RK62

Active member
Joined
Dec 29, 2010
Messages
33
Programming Experience
3-5
I'm trying to reuse a datatemplate defined in the window's resources but I receive "The resource ToolBarButtons could not be resolved" error.

The datatemplate, where I'm trying to bind to is (some code replaced with ...):
VB.NET:
<Window.Resources>
        
        <DataTemplate x:Key="ToolBarButtons">
            <Border Margin="2" Padding="2" BorderBrush="#FF1A1616" BorderThickness="2" CornerRadius="5" Background="#FF8D7E7E">
                <DockPanel>
                    <Button Name="NewGrid2" Style="{DynamicResource NoChromeButtonStyle}" Click="NewGrid_Click" >
                        <Image ..."></Image>
                    </Button>
                </DockPanel>
            </Border>
        </DataTemplate>

    </Window.Resources>

And the control that I want to bind:
VB.NET:
<ContentControl ContentTemplate="{StaticResource ToolbarButtons}"></ContentControl>

What is the problem here?
 
I suspect it's case sensitive - Try changing your resource name to ToolBarButtons
 
Back
Top