1234567891011121314151617181920212223242526272829303132333435 |
- using InABox.Core;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows;
- using System.Windows.Controls;
- using System.Windows.Media;
- using System.Windows.Media.Imaging;
- namespace InABox.DynamicGrid
- {
- public class DFFieldPlaceholderControl<TField> : DynamicFormControl<TField>
- where TField : DFLayoutField
- {
- protected override FrameworkElement Create()
- {
- var result = new Border();
- result.Child = new Label
- {
- Content = string.Format("[{0}]", Control.Name),
- HorizontalContentAlignment = HorizontalAlignment.Center,
- VerticalContentAlignment = VerticalAlignment.Center,
- FontWeight = FontWeights.DemiBold
- };
- var code = Control.Name; // GetPropertyValue<String>("Code");
- var variable = FormDesignGrid.Variables.FirstOrDefault(x => string.Equals(x.Code, code));
- result.Background = variable != null ? new SolidColorBrush(Colors.White) : new SolidColorBrush(Colors.Red);
- result.BorderBrush = BorderBrush;
- result.BorderThickness = new Thickness(0.75);
- return result;
- }
- }
- }
|