Как в Image программно указать картинку?
Файл "App.xaml":<Application x:Class="WpfApplication1.App"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:local="clr-namespace:WpfApplication1"
             StartupUri="MainWindow.xaml">
    <Application.Resources>
        <BitmapImage x:Key="MyImageSource" UriSource="H:\Temp\WpfApplication1\WpfApplication1\bin\Debug\icon1.png" />
    </Application.Resources>
</Application>
Файл "MainWindow.xaml":<Window x:Class="WpfApplication1.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:local="clr-namespace:WpfApplication1"
        mc:Ignorable="d"
        Title="MainWindow" Height="350" Width="525">
    <Grid>
        <Image Name="Fast" Width="15" Height="15" HorizontalAlignment="Stretch" Margin="0,0,170,0" Source="{DynamicResource MyImageSource}"/>
        <Button Name="button" Content="Button" HorizontalAlignment="Left" Margin="10,10,0,0" VerticalAlignment="Top" Width="75" Click="button_Click"/>
    </Grid>
</Window>
Файл "MainWindow.xaml.cs":using System;
using System.Windows;
using System.Windows.Media.Imaging;

namespace WpfApplication1
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
        }

        private void button_Click(object sender, RoutedEventArgs e)
        {
            Application.Current.Resources["MyImageSource"] =
                new BitmapImage(new Uri(@"H:\Temp\WpfApplication1\WpfApplication1\bin\Debug\icon2.png"));
        }
    }
}
По нажатию на кнопку происходит смена картинки на форме.
Нашёл я проблему с первым методом.
Надо было делать отдельный класс.#region Класс загрузки изображения в меню
public class Images
{
      public string IMGFast { get; set; }
      public string IMGFull { get; set; }
      public string BackColorFast { get; set; }
      public string BackColorFull { get; set; }
}
#endregion
В кнопке напримерDataContext = new Images[]
{
   new Images
   {
       IMGFast ="ok.png",
       BackColorFast = "#25FFFFFF",
       IMGFull ="",
       BackColorFull = ""
   }
};