Ejemplo n.º 1
0
 internal void BindTextBlock(TextBlock textblock)
 {
     FieldInfo[] fields = this.GetType().GetFields();
     foreach (FieldInfo field in fields)
     {
         DependencyProperty dp = (DependencyProperty)field.GetValue(this);
         DependencyProperty dpTextblock = (DependencyProperty)(textblock.GetType().GetField(string.Concat(dp.Name, "Property")).GetValue(textblock));
         Binding bindingTransform = new Binding(dp.Name);
         bindingTransform.Source = this;
         bindingTransform.Mode = BindingMode.OneWay;
         BindingOperations.SetBinding(textblock, dpTextblock, bindingTransform);
     }
 }
Ejemplo n.º 2
0
 private void clearOrderSelections()
 {
     foreach (UIElement e in Order.Children) {
         Label l = new Label() ;
         TextBlock test = new TextBlock();
         if (e.GetType() == test.GetType())
         {
             l.Content = ((TextBlock)e).Text;
         }
         else
         {
             l = (Label)e;
         }
         if (l.Tag != null && l.Tag.Equals("Item"))
         {
             if (!editing)
             {
                 l.Background = defaultBackground;
             }
         }
         else if (l.Tag != null && l.Tag.Equals("Option"))
         {
             l.Background = new SolidColorBrush(Colors.LightGreen);
             l.Foreground = new SolidColorBrush(Colors.Black);
         }
     }
 }