Esempio n. 1
0
		public static void SetStretchAmount(DependencyObject obj, Stretch amount)
		{
			FrameworkElement elem = obj as FrameworkElement;
			if (elem != null)
			{
				elem.Width *= amount.Amount;
			}

			obj.SetValue(StretchAmountProperty, amount);

			Console.WriteLine("SET STRETCH AMOUNT");
		}
Esempio n. 2
0
		public override object ConvertFrom (ITypeDescriptorContext context, CultureInfo culture, object value)
		{
			string sv = value as string;
			if (sv != null) {
				Stretch s = new Stretch ();
				int amount;
				if (Int32.TryParse (sv, out amount)) {
					s.Amount = amount;
					return s;
				}
			}
			return base.ConvertFrom (context, culture, value);
		}