1

is there a shorter way to get the icon from a resourceassembly? Something like the way for the Header property?

<MenuItem Header="{x:Static resx:Resource.Menue_Menue}">
  <MenuItem Header="{x:Static resx:Resource.Menue_Exit}" Command="{Binding ExitProgramCommand}">
    <MenuItem.Icon>
      <Image>
        <Image.Source>
          <BitmapImage UriSource="/Blubb.Resources;component/Icons/IconExit.ico" />
        </Image.Source>
      </Image>
    </MenuItem.Icon>
  </MenuItem>
</MenuItem>

Thanks in advance.

Phil83
  • 13
  • 7

1 Answers1

4

Sure, you can remove some code and have the same result:

<MenuItem Header="{x:Static resx:Resource.Menue_Exit}" Command="{Binding ExitProgramCommand}">
    <MenuItem.Icon>
        <Image Source="/Icons/IconExit.ico" />
    </MenuItem.Icon>
</MenuItem>
Łukasz Rejman
  • 1,892
  • 1
  • 11
  • 18
  • Okay, that's shorter. Thanks. Seem it is not easy to shorten it the way it is possible for the "Header". – Phil83 Mar 04 '15 at 08:40