03-01-2023, 04:01 PM
you can use the event "SelectionChanged" from combobox.
using System.Windows.Controls;
using System.Windows.Media.Imaging;
var b = new wpfBuilder("Window").WinSize(400, 400);
b.R.Add(out ComboBox cb).Items("Image 1|Image 2");
b.Row(-1).Add(out Image img);
b.End();
cb.SelectionChanged += (o, e) => {
switch (cb.SelectedIndex) {
case 0:
img.Source = new BitmapImage(new Uri(@"wallpaper-1.jpg"));
break;
case 1:
img.Source = new BitmapImage(new Uri(@"wallpaper-2.jpg"));
break;
}
};
if (!b.ShowDialog()) return;