tags:

views:

12

answers:

1

With below code image is not displaying

<DataTemplate x:Key="MenuButtonsTemplate">
  <StackPanel Margin="5">
    <TextBlock>
      <Button Style="{DynamicResource IconButtonStyle}" ToolTip="{Binding Path=DisplayName}" Command="{Binding Path=Command}" Height="21" Width="Auto" Foreground="White" >
          <Image Source="{Binding Path=DisplayName, StringFormat={}/project1;component/Images/{0}.png}" />
      </Button>
    </TextBlock>
  </StackPanel>
</DataTemplate>

if i use <Image Source="/project1;component/Images/edit.png}" /> it will work.

Is there any fix for this.

I need to display different images for the buttons added in stack panel. So i am trying to do string formatting in source binding.

A: 

The strng source property is converted to an image instance You need to bind to an image property, not a string property

vc 74