Version

Add Cloud Items to xamTagCloud

You can add any object to the xamTagCloud™ control’s Items collection. However, if you want to enable all of the xamTagCloud’s functionality, you must add XamTagCloudItem objects to its Items collection.

Setting the XamTagCloudItem object’s Weight and Content properties determines the tags in the cloud and the size of each individual tag item.

However, if you bind xamTagCloud to a different data source, you can set the Weight and Content properties as demonstrated in the Binding xamTagCloud to Data Using Procedural Code topic.

The following example demonstrates how to add items to xamTagCloud.

In XAML:

<ig:XamTagCloud MaxScale="5" MinScale="1" x:Name="tagCloud">
   <ig:XamTagCloudItem Content = "Silverlight" Weight = "10" />
   <ig:XamTagCloudItem Content = "ASP.Net" Weight = "2" />
   <ig:XamTagCloudItem Content = "WPF" Weight = "5" />
   <ig:XamTagCloudItem Content = "Window Forms" Weight = "5" />
   <ig:XamTagCloudItem Content = ".NET" Weight = "7" />
   …
</ig:XamTagCloud>

In Visual Basic:

Imports Infragistics.Controls.Menus
…
Dim cloudItem1 As New XamTagCloudItem With {.Content = "Silverlight", .Weight = 10}
tagCloud.Items.Add(cloudItem1)
Dim cloudItem2 As New XamTagCloudItem With {.Content = "ASP.NET", .Weight = 2}
tagCloud.Items.Add(cloudItem2)
Dim cloudItem3 As New XamTagCloudItem With {.Content = "WPF", .Weight = 5}
tagCloud.Items.Add(cloudItem3)
Dim cloudItem4 As New XamTagCloudItem With {.Content = "Windows Forms", .Weight = 5}
tagCloud.Items.Add(cloudItem4)
Dim cloudItem5 As New XamTagCloudItem With {.Content = ".NET", .Weight = 7}
tagCloud.Items.Add(cloudItem5)
…

In C#:

using Infragistics.Controls.Menus;
…
XamTagCloudItem cloudItem1 = new XamTagCloudItem { Content = "Silverlight", Weight = 10 };
tagCloud.Items.Add(cloudItem1);
XamTagCloudItem cloudItem2 = new XamTagCloudItem { Content = "ASP.NET", Weight = 2 };
tagCloud.Items.Add(cloudItem2);
XamTagCloudItem cloudItem3 = new XamTagCloudItem { Content = "WPF", Weight = 5 };
tagCloud.Items.Add(cloudItem3);
XamTagCloudItem cloudItem4 = new XamTagCloudItem { Content = "Windows Forms", Weight = 5 };
tagCloud.Items.Add(cloudItem4);
XamTagCloudItem cloudItem5 = new XamTagCloudItem { Content = ".NET", Weight = 7 };
tagCloud.Items.Add(cloudItem5);
…
Add Cloud Items to xamTagCloud