Beispiel #1
0
 internal TagCloudItemClickEventArgs(TagCloudItem item)
 {
     this.item = item;
 }
Beispiel #2
0
        private void CreateItemsFromData(System.Collections.IEnumerable dataSource)
        {
            foreach (object data in dataSource)
            {
                TagCloudItem item = new TagCloudItem();

                if (String.IsNullOrEmpty(this.DataHrefField))
                {
                    if (String.IsNullOrEmpty(this.DataHrefFormatString))
                    {
                        item.Href = String.Empty;
                    }
                    else
                    {
                        String.Format(CultureInfo.CurrentCulture, this.DataHrefFormatString, new object[] { data });
                    }
                }
                else
                {
                    item.Href = DataBinder.Eval(data, this.DataHrefField, this.DataHrefFormatString);
                }

                if (!String.IsNullOrEmpty(this.DataTextField))
                {
                    if (useWeightInTextFormat)
                    {
                        if (CultureInfo.CurrentCulture.TextInfo.IsRightToLeft)
                        {
                            this.DataTextFormatString = "<span class='tagcount'>({1})</span>{0}";
                        }
                        else
                        {
                            this.DataTextFormatString = "{0}<span class='tagcount'>({1})</span>";
                        }


                        item.Text = string.Format(CultureInfo.InvariantCulture,
                                                  this.DataTextFormatString,
                                                  DataBinder.Eval(data, this.DataTextField),
                                                  DataBinder.Eval(data, this.DataWeightField)
                                                  );
                    }
                    else
                    {
                        item.Text = DataBinder.Eval(data, this.DataTextField, this.DataTextFormatString);
                    }
                }

                if (!String.IsNullOrEmpty(this.DataTitleField))
                {
                    item.Title = DataBinder.Eval(data, this.DataTitleField, this.DataTitleFormatString);
                }

                if (!String.IsNullOrEmpty(this.DataWeightField))
                {
                    item.Weight = Convert.ToDouble(DataBinder.GetPropertyValue(data, this.DataWeightField));
                }

                this.Items.Add(item);
            }
        }