Images and WPF

Insert image in WPF

<Image Source="pack://application:,,,/OrderFormUI;component/Resources/about.png"
    Stretch="Uniform"
    VerticalAlignment="Top"></Image>

The image is added as "Resource":

Add image to MenuItem

<MenuItem x:Name="MenuCalendar"
          Header="Menu Text">
    <MenuItem.Icon>
        <Image Source="/CommonFormMakerControlsWPF;component/images/fields/cal.png"></Image>
    </MenuItem.Icon>
</MenuItem>

Set image in code

var s = "pack://application:,,,/OrderFormUI;component/Resources/label_email_en.png";
ImageMailLabel.Source = new BitmapImage(new Uri(s));


Datenschutzerklärung | Impressum