BetterExplorer.PieChart.LegendConverter.Convert C# (CSharp) 메소드

Convert() 공개 메소드

public Convert ( object value, Type targetType, object parameter, CultureInfo culture ) : object
value object
targetType System.Type
parameter object
culture System.Globalization.CultureInfo
리턴 object
		public object Convert(object value, Type targetType, object parameter, CultureInfo culture) {
			// the item which we are displaying is bound to the Tag property
			TextBlock label = (TextBlock)value;
			object item = label.Tag;

			// find the item container
			DependencyObject container = (DependencyObject)Helpers.FindElementOfTypeUp((Visual)value, typeof(ListBoxItem));

			// locate the items control which it belongs to
			ItemsControl owner = ItemsControl.ItemsControlFromItemContainer(container);

			// locate the legend
			Legend legend = (Legend)Helpers.FindElementOfTypeUp(owner, typeof(Legend));

			PropertyDescriptorCollection filterPropDesc = TypeDescriptor.GetProperties(item);
			object itemValue = filterPropDesc[legend.PlottedProperty].GetValue(item);
			return itemValue;
		}
LegendConverter