Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p><code>ItemCount</code> belongs to the <a href="http://msdn.microsoft.com/en-us/library/system.windows.data.collectionviewgroup.aspx" rel="nofollow"><strong>group</strong></a> inside the collection view that is generated from that Tag.</p> <p>e.g. if i have a list</p> <blockquote> <p>A A B B B C</p> </blockquote> <p>And i group them i get:</p> <blockquote> <p>Group A : ItemCount = 2<br/> Group B : ItemCount = 3<br/> Group C : ItemCount = 1</p> </blockquote> <p>The whole point of a Tag-Cloud is to bind to that very property because you want to visualize how often a certain tag is used.</p> <hr> <p>To respond to your comments, the bare-bones setup should be something like this:</p> <pre><code>&lt;ItemsControl ItemsSource="{Binding Data}"&gt; &lt;ItemsControl.Resources&gt; &lt;vc:CountToFontSizeConverter x:Key="CountToFontSizeConverter"/&gt; &lt;/ItemsControl.Resources&gt; &lt;ItemsControl.ItemsPanel&gt; &lt;ItemsPanelTemplate&gt; &lt;WrapPanel /&gt; &lt;/ItemsPanelTemplate&gt; &lt;/ItemsControl.ItemsPanel&gt; &lt;ItemsControl.ItemTemplate&gt; &lt;DataTemplate&gt; &lt;TextBlock Text="{Binding Name}" Margin="2" FontSize="{Binding Count, Converter={StaticResource CountToFontSizeConverter}}"/&gt; &lt;/DataTemplate&gt; &lt;/ItemsControl.ItemTemplate&gt; &lt;/ItemsControl&gt; </code></pre> <p>I assume that your data-object class exposes the properties <code>Name</code> and <code>Count</code>, to make sure that the size changes as count goes up that data-object class needs to implement <a href="http://msdn.microsoft.com/en-us/library/system.componentmodel.inotifypropertychanged.aspx" rel="nofollow"><code>INotifyPropertyChanged</code></a>, that is about all there is to it.</p> <pre><code>public class Tag : INotifyPropertyChanged { private string _name = null; public string Name { get { return _name; } set { if (_name != value) { _name = value; OnPropertyChanged("Name"); } } } private int _count = 0; public int Count { get { return _count; } set { if (_count != value) { _count = value; OnPropertyChanged("Count"); } } } //... public event PropertyChangedEventHandler PropertyChanged; protected virtual void OnPropertyChanged(string propertyName) { if (this.PropertyChanged != null) { this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); } } } </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