は、実行時に決定される資産の一部のXAMLです:
<Image Source="{Binding Converter={StaticResource SomeImageSourceConverter}}"
x:Name="SomeImage"/>
そして、これはコードビハインドである:
SomeImage.DataContext = "pack://application:,,,/.../SomeImagePlaceAtRuntime.png";
public class SomeImageSourceConverter : IValueConverter
{
public object Convert(object value, Type targetType,
object parameter_, System.Globalization.CultureInfo culture_)
{
return (new ImageSourceConverter()).ConvertFromString(value.ToString());
}
public object ConvertBack(object value, Type targetType,
object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
のでDataContext
の値に応じて、それがされます異なる画像を読み込みます。
ここで、アセットは表示されません。 詳細はこちらをご覧ください。 –
もちろん、すぐ編集。 – agiro