tags:

views:

48

answers:

1

I'm trying to add little icons to my tabs in WPF but having trouble with how to set up the binding.

<TabItem.Header>
    <StackPanel Orientation="Horizontal">
          <Image Source="{Binding Source=prop:Resources.eye}" />
          <Label VerticalAlignment="Center">Header</Label>
    </StackPanel>
</TabItem.Header>

The xmlns:prop is set up for the local project's Properties, I am pulling other values from it elsewhere so I know that the namespace works. The markup above compiles fine BUT I don't see the eye image in the tab.

Also, is there any way to set this up into a template? I'm fairly new to XAML/WPF and each tab will have its own image...

A: 

Guessing without sufficient detail in your question, but you're setting the source of the binding to the string "prop:Resources.eye". What you want to do is resolve the string into the resource and assign that as the source:

<Image Source="{Binding Source={StaticResource prop:Resources.eye}}" />

HTH,
Kent

Kent Boogaart