|
| 1 | +using Project1.UI.Cores; |
| 2 | +using System; |
| 3 | +using System.Collections.Generic; |
| 4 | +using System.Diagnostics; |
| 5 | +using System.Linq; |
| 6 | +using System.Text; |
| 7 | +using System.Threading.Tasks; |
| 8 | +using System.Windows; |
| 9 | +using System.Windows.Media; |
| 10 | +using System.Windows.Media.Imaging; |
| 11 | + |
| 12 | +namespace Project1.UI.Controls.Models |
| 13 | +{ |
| 14 | + public class DesignItemModel : UINotifyPropertyChanged |
| 15 | + { |
| 16 | + private System.Windows.Visibility ControlPointVisibility_; |
| 17 | + public System.Windows.Visibility ControlPointVisibility |
| 18 | + { |
| 19 | + get { return ControlPointVisibility_; } |
| 20 | + set { ControlPointVisibility_ = value; OnPropertyChanged(); } |
| 21 | + } |
| 22 | + |
| 23 | + //通用属性 |
| 24 | + #region 宽 |
| 25 | + public double Width_; |
| 26 | + /// <summary> |
| 27 | + /// 宽 |
| 28 | + /// </summary> |
| 29 | + public double Width |
| 30 | + { |
| 31 | + get { return Width_; } |
| 32 | + set |
| 33 | + { |
| 34 | + Width_ = value; |
| 35 | + OnPropertyChanged(); |
| 36 | + } |
| 37 | + } |
| 38 | + #endregion |
| 39 | + |
| 40 | + #region 高 |
| 41 | + public double Height_; |
| 42 | + /// <summary> |
| 43 | + /// 高 |
| 44 | + /// </summary> |
| 45 | + public double Height |
| 46 | + { |
| 47 | + get { return Height_; } |
| 48 | + set |
| 49 | + { |
| 50 | + Height_ = value; |
| 51 | + OnPropertyChanged(); |
| 52 | + } |
| 53 | + } |
| 54 | + #endregion |
| 55 | + |
| 56 | + |
| 57 | + #region 背景色 |
| 58 | + public Brush Background_ = Brushes.Black; |
| 59 | + /// <summary> |
| 60 | + /// 背景色 |
| 61 | + /// </summary> |
| 62 | + public Brush Background |
| 63 | + { |
| 64 | + get { return Background_; } |
| 65 | + set |
| 66 | + { |
| 67 | + Background_ = value; |
| 68 | + OnPropertyChanged(); |
| 69 | + } |
| 70 | + } |
| 71 | + #endregion |
| 72 | + |
| 73 | + #region 边宽色 |
| 74 | + public Brush BorderColor_ = Brushes.Transparent; |
| 75 | + /// <summary> |
| 76 | + /// 边框色 |
| 77 | + /// </summary> |
| 78 | + public Brush BorderColor |
| 79 | + { |
| 80 | + get { return BorderColor_; } |
| 81 | + set |
| 82 | + { |
| 83 | + BorderColor_ = value; |
| 84 | + OnPropertyChanged(); |
| 85 | + } |
| 86 | + } |
| 87 | + #endregion |
| 88 | + |
| 89 | + #region 透明度 |
| 90 | + public double Opacity_ = 1; |
| 91 | + /// <summary> |
| 92 | + /// 透明度(0~1) |
| 93 | + /// </summary> |
| 94 | + public double Opacity |
| 95 | + { |
| 96 | + get { return Opacity_; } |
| 97 | + set |
| 98 | + { |
| 99 | + Opacity_ = value; |
| 100 | + OnPropertyChanged(); |
| 101 | + } |
| 102 | + } |
| 103 | + #endregion |
| 104 | + |
| 105 | + #region 文字大小 |
| 106 | + public double FontSize_ = 12; |
| 107 | + /// <summary> |
| 108 | + /// 文字大小 |
| 109 | + /// </summary> |
| 110 | + public double FontSize |
| 111 | + { |
| 112 | + get { return FontSize_; } |
| 113 | + set |
| 114 | + { |
| 115 | + FontSize_ = value; |
| 116 | + OnPropertyChanged(); |
| 117 | + } |
| 118 | + } |
| 119 | + #endregion |
| 120 | + |
| 121 | + #region 文字色 |
| 122 | + public Brush TextColor_ = Brushes.Black; |
| 123 | + /// <summary> |
| 124 | + /// 边框色 |
| 125 | + /// </summary> |
| 126 | + public Brush TextColor |
| 127 | + { |
| 128 | + get { return TextColor_; } |
| 129 | + set |
| 130 | + { |
| 131 | + TextColor_ = value; |
| 132 | + OnPropertyChanged(); |
| 133 | + } |
| 134 | + } |
| 135 | + #endregion |
| 136 | + |
| 137 | + #region 文字宽度 |
| 138 | + /// <summary> |
| 139 | + /// 边框色 |
| 140 | + /// </summary> |
| 141 | + public FontWeight FontWeight |
| 142 | + { |
| 143 | + get { return IsFontBold ? FontWeights.Bold : FontWeights.Normal; } |
| 144 | + } |
| 145 | + #endregion |
| 146 | + |
| 147 | + #region 是否加粗 |
| 148 | + public bool IsFontBold_ = false; |
| 149 | + /// <summary> |
| 150 | + /// 文字大小 |
| 151 | + /// </summary> |
| 152 | + public bool IsFontBold |
| 153 | + { |
| 154 | + get { return IsFontBold_; } |
| 155 | + set |
| 156 | + { |
| 157 | + IsFontBold_ = value; |
| 158 | + OnPropertyChanged(); |
| 159 | + } |
| 160 | + } |
| 161 | + #endregion |
| 162 | + |
| 163 | + //文本类型元素属性 |
| 164 | + |
| 165 | + #region 文字 |
| 166 | + public string Text_; |
| 167 | + /// <summary> |
| 168 | + /// 文字 |
| 169 | + /// </summary> |
| 170 | + public string Text |
| 171 | + { |
| 172 | + get { return Text_; } |
| 173 | + set |
| 174 | + { |
| 175 | + Text_ = value; |
| 176 | + OnPropertyChanged(); |
| 177 | + } |
| 178 | + } |
| 179 | + #endregion |
| 180 | + |
| 181 | + //按钮类型元素属性 |
| 182 | + |
| 183 | + #region 按钮文字 |
| 184 | + public string ButtonText_; |
| 185 | + /// <summary> |
| 186 | + /// 按钮文字 |
| 187 | + /// </summary> |
| 188 | + public string ButtonText |
| 189 | + { |
| 190 | + get { return ButtonText_; } |
| 191 | + set |
| 192 | + { |
| 193 | + ButtonText_ = value; |
| 194 | + OnPropertyChanged(); |
| 195 | + } |
| 196 | + } |
| 197 | + #endregion |
| 198 | + |
| 199 | + #region 按钮样式名 |
| 200 | + public string ButtonStyleName_; |
| 201 | + /// <summary> |
| 202 | + /// 按钮样式名 |
| 203 | + /// </summary> |
| 204 | + public string ButtonStyleName |
| 205 | + { |
| 206 | + get { return ButtonStyleName_; } |
| 207 | + set |
| 208 | + { |
| 209 | + ButtonStyleName_ = value; |
| 210 | + OnPropertyChanged(); |
| 211 | + } |
| 212 | + } |
| 213 | + #endregion |
| 214 | + |
| 215 | + #region 按钮样式 |
| 216 | + public Style ButtonStyle_; |
| 217 | + /// <summary> |
| 218 | + /// 按钮样式名 |
| 219 | + /// </summary> |
| 220 | + public Style ButtonStyle |
| 221 | + { |
| 222 | + get { return ButtonStyle_; } |
| 223 | + set |
| 224 | + { |
| 225 | + ButtonStyle_ = value; |
| 226 | + OnPropertyChanged(); |
| 227 | + } |
| 228 | + } |
| 229 | + #endregion |
| 230 | + |
| 231 | + #region 命令 |
| 232 | + public string Command_; |
| 233 | + /// <summary> |
| 234 | + /// 文字 |
| 235 | + /// </summary> |
| 236 | + public string Command |
| 237 | + { |
| 238 | + get { return Command_; } |
| 239 | + set |
| 240 | + { |
| 241 | + Command_ = value; |
| 242 | + OnPropertyChanged(); |
| 243 | + } |
| 244 | + } |
| 245 | + #endregion |
| 246 | + //图片类型元素属性 |
| 247 | + |
| 248 | + #region 图片 |
| 249 | + public ImageSource ImageSource_; |
| 250 | + public ImageSource ImageSource |
| 251 | + { |
| 252 | + get |
| 253 | + { |
| 254 | + return ImageSource_; |
| 255 | + } |
| 256 | + set |
| 257 | + { |
| 258 | + ImageSource_ = value; |
| 259 | + } |
| 260 | + } |
| 261 | + public string Image_ = ""; |
| 262 | + /// <summary> |
| 263 | + /// 图片路径 |
| 264 | + /// </summary> |
| 265 | + public string Image |
| 266 | + { |
| 267 | + get { return Image_; } |
| 268 | + set |
| 269 | + { |
| 270 | + try |
| 271 | + { |
| 272 | + var image = new BitmapImage(new Uri(value, UriKind.RelativeOrAbsolute)); |
| 273 | + Image_ = value; |
| 274 | + //Width = image.Width; |
| 275 | + //Height = image.Height; |
| 276 | + ImageSource = image; |
| 277 | + OnPropertyChanged(); |
| 278 | + } |
| 279 | + catch |
| 280 | + { |
| 281 | + |
| 282 | + } |
| 283 | + } |
| 284 | + } |
| 285 | + #endregion |
| 286 | + |
| 287 | + } |
| 288 | +} |
0 commit comments