|
@@ -0,0 +1,83 @@
|
|
|
+using PDF_Office.Model.From;
|
|
|
+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.Data;
|
|
|
+using System.Windows.Documents;
|
|
|
+using System.Windows.Input;
|
|
|
+using System.Windows.Media;
|
|
|
+using System.Windows.Media.Imaging;
|
|
|
+using System.Windows.Navigation;
|
|
|
+using System.Windows.Shapes;
|
|
|
+
|
|
|
+namespace PDF_Office.CustomControl.Form
|
|
|
+{
|
|
|
+ /// <summary>
|
|
|
+ /// FormFieldCombox.xaml 的交互逻辑
|
|
|
+ /// 用于表单显示字段的下拉控件
|
|
|
+ /// </summary>
|
|
|
+ public partial class FormFieldCombox : UserControl
|
|
|
+ {
|
|
|
+ public FormFieldCombox()
|
|
|
+ {
|
|
|
+ InitializeComponent();
|
|
|
+ InitCombox();
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ public FormFieldType Type
|
|
|
+ {
|
|
|
+ get { return (FormFieldType)GetValue(TypeProperty); }
|
|
|
+ set { SetValue(TypeProperty, value); }
|
|
|
+ }
|
|
|
+
|
|
|
+ // Using a DependencyProperty as the backing store for MyProperty. This enables animation, styling, binding, etc...
|
|
|
+ public static readonly DependencyProperty TypeProperty =
|
|
|
+ DependencyProperty.Register("MyProperty", typeof(FormFieldType), typeof(FormFieldCombox), new PropertyMetadata(FormFieldType.visible));
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ public FormFieldType SetType
|
|
|
+ {
|
|
|
+ get { return (FormFieldType)GetValue(SetTypeProperty); }
|
|
|
+ set { SetValue(SetTypeProperty, value); }
|
|
|
+ }
|
|
|
+
|
|
|
+ // Using a DependencyProperty as the backing store for SetType. This enables animation, styling, binding, etc...
|
|
|
+ public static readonly DependencyProperty SetTypeProperty =
|
|
|
+ DependencyProperty.Register("SetType", typeof(FormFieldType), typeof(FormFieldCombox), new PropertyMetadata(FormFieldType.visible,(d,e)=> {
|
|
|
+ (d as FormFieldCombox).SetIndexBySetType((FormFieldType)e.NewValue);
|
|
|
+ }));
|
|
|
+
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 根据settype 设置combox索引
|
|
|
+ /// </summary>
|
|
|
+ private void SetIndexBySetType(FormFieldType type)
|
|
|
+ {
|
|
|
+ Combox.SelectedIndex=(int)type;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ private void InitCombox()
|
|
|
+ {
|
|
|
+ List<string> list = new List<string>();
|
|
|
+ list.Add("可见");
|
|
|
+ list.Add("隐藏");
|
|
|
+ list.Add("可见但不可打印");
|
|
|
+ list.Add("隐藏但可打印");
|
|
|
+ Combox.ItemsSource = list;
|
|
|
+ }
|
|
|
+
|
|
|
+ private void Combox_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
|
|
+ {
|
|
|
+ Type = (FormFieldType)Combox.SelectedIndex;
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|