Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Create a <a href="http://msdn.microsoft.com/en-us/library/system.windows.data.ivalueconverter.aspx" rel="noreferrer">Value Converter</a></p> <p>It takes your enum value and returns the filename of the appropriate icon.</p> <pre><code>[ValueConversion(typeof(AcceptationStatusGlobalFlag), typeof(string))] public class AcceptationStatusGlobalFlagToIconFilenameConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { switch ((AcceptationStatusGlobalFlag)value) { case AcceptationStatusGlobalFlag.Ready: return "ready.jpg"; case AcceptationStatusGlobalFlag.NotReady: return "notready.jpg"; case AcceptationStatusGlobalFlag.AcceptedByAdmin: return "AcceptedByAdmin.jpg"; default: return null; } // or return Enum.GetName(typeof(AcceptationStatusGlobalFlag), value) + ".jpg"; } public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { throw new NotSupportedException(); } } </code></pre> <p>You will need to add a reference to this converter in your XAML</p> <pre><code>&lt;Window ... xmlns:converters="clr-namespace:App.Converters" ...&gt; &lt;Window.Resources&gt; &lt;converters:AcceptationStatusGlobalFlagToIconFilenameConverter x:Key="IconConverter"/&gt; &lt;/Window.Resources&gt; </code></pre> <p>Replace your TextBlock</p> <pre><code>&lt;TextBlock TextAlignment="Justify" VerticalAlignment="Center" Text="{Binding Path=AcceptationStatusGlobalFlag}" /&gt; </code></pre> <p>with an Image and tell it use your converter</p> <pre><code>&lt;Image Source="{Binding AcceptationStatusGlobalFlag, Converter={StaticResource IconConverter}}"/&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload