internal void SetParent(LabelProperties parentLabelProperties) { FieldInfo[] fields = this.GetType().GetFields(); foreach (FieldInfo field in fields) { DependencyProperty dp = (DependencyProperty)field.GetValue(this); DependencyProperty dpTextblock = (DependencyProperty)(parentLabelProperties.GetType().GetField(string.Concat(dp.Name, "Property")).GetValue(parentLabelProperties)); Binding bindingTransform = new Binding(dp.Name); bindingTransform.Source = parentLabelProperties; bindingTransform.Mode = BindingMode.OneWay; BindingOperations.SetBinding(this, dpTextblock, bindingTransform); } }
/// <summary> /// Constructor offering the ability to bind the new object to a parent. /// </summary> /// <param name="parentLabelProperties">Parent set of properties.</param> public LabelProperties(LabelProperties parentLabelProperties) : base() { SetParent(parentLabelProperties); }
/// <summary> /// Constructor offering the ability to bind the new object to a parent. /// </summary> /// <param name="parentLabelProperties">Parent set of properties.</param> public LabelProperties(LabelProperties parentLabelProperties) : base() { SetParent(parentLabelProperties); }
internal void SetParent(LabelProperties parentLabelProperties) { FieldInfo[] fields = this.GetType().GetFields(); foreach (FieldInfo field in fields) { DependencyProperty dp = (DependencyProperty)field.GetValue(this); DependencyProperty dpTextblock = (DependencyProperty)(parentLabelProperties.GetType().GetField(string.Concat(dp.Name, "Property")).GetValue(parentLabelProperties)); Binding bindingTransform = new Binding(dp.Name); bindingTransform.Source = parentLabelProperties; bindingTransform.Mode = BindingMode.OneWay; BindingOperations.SetBinding(this, dpTextblock, bindingTransform); } }
public Axis3D(Axes3D axes, Axis3DCollection axisCollection) { axisLabels = new List<TextBlock>(); labelProperties = new LabelProperties(axisCollection.TickLabels); model3D = new LinesModel3D(); this.axes = axes; this.axisCollection = axisCollection; this.axes.Children.Add(model3D); }