static void OnTickLabelFontFamilyChanged(DependencyObject obj, DependencyPropertyChangedEventArgs e) { PriceTicksElement thisElement = obj as PriceTicksElement; if (thisElement == null) { return; } thisElement.currentTypeFace = new Typeface(thisElement.TickLabelFontFamily.ToString()); }
private static object CoerceCurrentPriceLabelBackground(DependencyObject objWithOldDP, object newDPValue) { PriceTicksElement thisElement = (PriceTicksElement)objWithOldDP; Brush newBrushValue = (Brush)newDPValue; if (newBrushValue.IsFrozen) { return(newDPValue); } else { return((Brush)newBrushValue.GetCurrentValueAsFrozen()); } }
private static object CoerceTickColor(DependencyObject objWithOldDP, object newDPValue) { PriceTicksElement thisElement = (PriceTicksElement)objWithOldDP; Brush newBrushValue = (Brush)newDPValue; if (newBrushValue.IsFrozen) { Pen p = new Pen(newBrushValue, 1.0); p.Freeze(); thisElement.tickPen = p; return(newDPValue); } else { Brush b = (Brush)newBrushValue.GetCurrentValueAsFrozen(); Pen p = new Pen(b, 1.0); p.Freeze(); thisElement.tickPen = p; return(b); } }