Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Instead of using <code>List&lt;ImageSource&gt;</code> you should use <code>CompositeCollection</code> (<a href="http://msdn.microsoft.com/en-US/library/system.windows.data.compositecollection.aspx" rel="nofollow">msdn</a>)</p> <pre><code>public CompositeCollection ImageList { get { return (CompositeCollection)GetValue(ImageListProperty); } set { SetValue(ImageListProperty, value); } } public static readonly DependencyProperty ImageListProperty = DependencyProperty.Register("ImageList", typeof(CompositeCollection), typeof(CustomUserControl), new PropertyMetadata(new CompositeCollection())); </code></pre> <p>And now you can set values in the defined style like this:</p> <pre><code>&lt;my:CustomUserControl x:Name="myCustomUserControl &lt;my:CustomUserControl.Style&gt; &lt;Style TargetType="{x:Type my:CustomUserControl}"&gt; &lt;Setter Property="my:CustomUserControl.ImageList"&gt; &lt;Setter.Value&gt; &lt;CompositeCollection&gt; &lt;BitmapImage UriSource="Bla.png"/&gt; &lt;BitmapImage UriSource="Bla2.png"/&gt; &lt;/CompositeCollection&gt; &lt;/Setter.Value&gt; &lt;/Setter&gt; &lt;/Style&gt; &lt;/my:CustomUserControl.Style&gt; &lt;/my:CustomUserControl&gt; </code></pre> <p>Other binding works in the same way as you presented in your question.</p> <p>e.g.:</p> <pre><code>&lt;my:CustomUserControl x:Name="myCustomUserControl"&gt; &lt;my:CustomUserControl.ImageList&gt; &lt;BitmapImage UriSource="Bla.png" /&gt; &lt;BitmapImage UriSource="Bla2.png" /&gt; &lt;/my:CustomUserControl.ImageList&gt; &lt;/my:CustomUserControl&gt; </code></pre>
 

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