当前位置: 首页 > news >正文

营销网站建设哪里便宜北京朝阳区

营销网站建设哪里便宜,北京朝阳区,我做的网站怎么是危险网站,网站 做 app开发完全来源于十月的寒流#xff0c;感谢大佬讲解 依赖属性 由依赖属性提供的属性功能 与字段支持的属性不同#xff0c;依赖属性扩展了属性的功能。 通常#xff0c;添加的功能表示或支持以下功能之一#xff1a; 资源数据绑定样式动画元数据重写属性值继承WPF 设计器集成 …完全来源于十月的寒流感谢大佬讲解 依赖属性 由依赖属性提供的属性功能 与字段支持的属性不同依赖属性扩展了属性的功能。 通常添加的功能表示或支持以下功能之一 资源数据绑定样式动画元数据重写属性值继承WPF 设计器集成 public partial class MainWindow : Window{public MainWindow(){InitializeComponent();CustomTextBox customTextBox new CustomTextBox();customTextBox.IsHightLighted true;customTextBox.SetValue(CustomTextBox.IsHightLightedProperty, true);}}public class CustomTextBox : TextBox{public bool IsHightLighted{get { return (bool)GetValue(IsHightLightedProperty); }set { SetValue(IsHightLightedProperty, value); }}public static readonly DependencyProperty IsHightLightedProperty DependencyProperty.Register(IsHightLighted, typeof(bool), typeof(CustomTextBox), new PropertyMetadata(false));}#region HasText public bool HasText (bool)GetValue(HasTextProperty);public static readonly DependencyProperty HasTextProperty; public static readonly DependencyPropertyKey HasTextPropertyKey;static CustomTextBox() {HasTextPropertyKey DependencyProperty.RegisterReadOnly(HasText,typeof(bool),typeof(CustomTextBox),new PropertyMetadata(false));HasTextProperty HasTextPropertyKey.DependencyProperty; } #endregionWindow x:ClassTest_05.MainWindowxmlnshttp://schemas.microsoft.com/winfx/2006/xaml/presentationxmlns:xhttp://schemas.microsoft.com/winfx/2006/xamlxmlns:dhttp://schemas.microsoft.com/expression/blend/2008xmlns:mchttp://schemas.openxmlformats.org/markup-compatibility/2006xmlns:localclr-namespace:Test_05mc:IgnorabledTitleMainWindow Height450 Width800Window.ResourcesStyle TargetTypelocal:CustomTextBoxStyle.TriggersTrigger PropertyIsHightLighted ValueTrueSetter PropertyBackground ValueYellow/Setter/TriggerTrigger PropertyIsHightLighted ValueFalseSetter PropertyBackground ValueBlue/Setter/Trigger/Style.Triggers/Style/Window.ResourcesStackPanellocal:CustomTextBox TextHello World! FontSize30 IsHightLightedTrue/local:CustomTextBox/StackPanel /Window附加属性 StackPanel!--local:CustomTextBox TextHello World! FontSize30 IsHightLightedTrue/local:CustomTextBox--local:CustomTextBox TextHello World! FontSize30local:CustomTextBox.IsHightLightedtrue/local:CustomTextBox.IsHightLightedGrid.Row1/Grid.Row/local:CustomTextBox/StackPanelStackPanellocal:CustomTextBox x:Nameaoteman local:TextBoxHelper.Titlethis is test FontSize30Text{Binding RelativeSource{RelativeSource self}, Path(local:TextBoxHelper.Title)}/local:CustomTextBox!--local:CustomTextBox x:Nameaoteman FontSize30Text{Binding RelativeSource{RelativeSource self}, Path(local:TextBoxHelper.Title)}/local:CustomTextBox-- /StackPanelpublic partial class MainWindow : Window {public MainWindow(){InitializeComponent();//TextBoxHelper.SetTitle(aoteman, this is aoteman);} }public class CustomTextBox : TextBox {public bool IsHightLighted{get { return (bool)GetValue(IsHightLightedProperty); }set { SetValue(IsHightLightedProperty, value); }}public static readonly DependencyProperty IsHightLightedProperty DependencyProperty.Register(IsHightLighted, typeof(bool), typeof(CustomTextBox), new PropertyMetadata(false));public bool HasText (bool)GetValue(HasTextProperty);public static readonly DependencyProperty HasTextProperty;public static readonly DependencyPropertyKey HasTextPropertyKey;static CustomTextBox(){HasTextPropertyKey DependencyProperty.RegisterReadOnly(HasText,typeof(bool),typeof(CustomTextBox),new PropertyMetadata(false));HasTextProperty HasTextPropertyKey.DependencyProperty;} }public class TextBoxHelper {public static string GetTitle(DependencyObject obj){return (string)obj.GetValue(TitleProperty);}public static void SetTitle(DependencyObject obj, string value){obj.SetValue(TitleProperty, value);}// Using a DependencyProperty as the backing store for Title. This enables animation, styling, binding, etc...public static readonly DependencyProperty TitleProperty DependencyProperty.RegisterAttached(Title, typeof(string), typeof(TextBoxHelper), new PropertyMetadata()); }TextBox HasText实现一 Window x:ClassTest_01.MainWindowxmlnshttp://schemas.microsoft.com/winfx/2006/xaml/presentationxmlns:xhttp://schemas.microsoft.com/winfx/2006/xamlxmlns:dhttp://schemas.microsoft.com/expression/blend/2008xmlns:mchttp://schemas.openxmlformats.org/markup-compatibility/2006xmlns:localclr-namespace:Test_01mc:IgnorabledTitleMainWindow Height450 Width800Window.Resources/Window.ResourcesStackPanel!--local:CustomTextBox x:Nameaoteman local:TextBoxHelper.Titlethis is test FontSize30Text{Binding RelativeSource{RelativeSource self}, Path(local:TextBoxHelper.Title)}/local:CustomTextBox--TextBox x:NametBox Text1234 FontSize30 local:TextBoxHelper.MonitorTextChangeTrue/TextBoxCheckBox IsChecked{Binding ElementNametBox, Path(local:TextBoxHelper.HasText)} FontSize30/CheckBox/StackPanel /Windowusing 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 Test_01 {/// summary/// MainWindow.xaml 的交互逻辑/// /summarypublic partial class MainWindow : Window{public MainWindow(){InitializeComponent();}}public class TextBoxHelper{public static bool GetHasText(DependencyObject obj){return (bool)obj.GetValue(HasTextProperty);}public static void SetHasText(DependencyObject obj, bool value){obj.SetValue(HasTextProperty, value);}public static readonly DependencyProperty HasTextProperty DependencyProperty.RegisterAttached(HasText,typeof(bool),typeof(TextBoxHelper),new PropertyMetadata(false));public static bool GetMonitorTextChange(DependencyObject obj){return (bool)obj.GetValue(MonitorTextChangeProperty);}public static void SetMonitorTextChange(DependencyObject obj, bool value){obj.SetValue(MonitorTextChangeProperty, value);}// Using a DependencyProperty as the backing store for MonitorTextChange. This enables animation, styling, binding, etc...public static readonly DependencyProperty MonitorTextChangeProperty DependencyProperty.RegisterAttached(MonitorTextChange,typeof(bool),typeof(TextBoxHelper),new PropertyMetadata(false, MonitorTextChangedPropertyChanged));private static void MonitorTextChangedPropertyChanged(DependencyObject d,DependencyPropertyChangedEventArgs e){if (d is TextBox box false){throw new NotSupportedException();}if ((bool)e.NewValue){box.TextChanged TextChanged;SetHasText(box, !string.IsNullOrEmpty(box.Text));}else{box.TextChanged - TextChanged;}}private static void TextChanged(object sender, TextChangedEventArgs e){var box sender as TextBox;SetHasText(box, !string.IsNullOrEmpty(box.Text));}} }TextBox HasText只读实现二 Window x:ClassTest_01.MainWindowxmlnshttp://schemas.microsoft.com/winfx/2006/xaml/presentationxmlns:xhttp://schemas.microsoft.com/winfx/2006/xamlxmlns:dhttp://schemas.microsoft.com/expression/blend/2008xmlns:mchttp://schemas.openxmlformats.org/markup-compatibility/2006xmlns:localclr-namespace:Test_01mc:Ignorabled TitleMainWindow Height450 Width800Window.Resources/Window.ResourcesStackPanel!--local:CustomTextBox x:Nameaoteman local:TextBoxHelper.Titlethis is test FontSize30Text{Binding RelativeSource{RelativeSource self}, Path(local:TextBoxHelper.Title)}/local:CustomTextBox--TextBox x:NametBox Text1234 FontSize30 local:TextBoxHelper.MonitorTextChangeTrue/TextBoxCheckBox IsChecked{Binding ElementNametBox, Path(local:TextBoxHelper.HasText), ModeOneWay} FontSize30/CheckBox/StackPanel /Window using System; using System.Collections.Generic; using System.Linq; using System.Security.Policy; 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 Test_01 {/// summary/// MainWindow.xaml 的交互逻辑/// /summarypublic partial class MainWindow : Window{public MainWindow(){InitializeComponent();}}public class TextBoxHelper{static TextBoxHelper(){HasTextProperty HasTextPropertyKey.DependencyProperty;}public static bool GetHasText(DependencyObject obj){return (bool)obj.GetValue(HasTextProperty);}public static void SetHasText(DependencyObject obj, bool value){obj.SetValue(HasTextPropertyKey, value);}public static readonly DependencyProperty HasTextProperty;public static readonly DependencyPropertyKey HasTextPropertyKey DependencyProperty.RegisterAttachedReadOnly(HasText,typeof(bool),typeof(TextBoxHelper),new PropertyMetadata(false));public static bool GetMonitorTextChange(DependencyObject obj){return (bool)obj.GetValue(MonitorTextChangeProperty);}public static void SetMonitorTextChange(DependencyObject obj, bool value){obj.SetValue(MonitorTextChangeProperty, value);}public static readonly DependencyProperty MonitorTextChangeProperty DependencyProperty.RegisterAttached(MonitorTextChange,typeof(bool),typeof(TextBoxHelper),new PropertyMetadata(false, MonitorTextChangedPropertyChanged));private static void MonitorTextChangedPropertyChanged(DependencyObject d,DependencyPropertyChangedEventArgs e){if (d is TextBox box false){throw new NotSupportedException();}if ((bool)e.NewValue){box.TextChanged TextChanged;SetHasText(box, !string.IsNullOrEmpty(box.Text));}else{box.TextChanged - TextChanged;}}private static void TextChanged(object sender, TextChangedEventArgs e){var box sender as TextBox;SetHasText(box, !string.IsNullOrEmpty(box.Text));}} }{Binding}解释 local:TextBoxHelper.MonitorTextChangeTrue这是自定义属性local:TextBoxHelper.MonitorTextChange的设置是自定义控件或附加属性的一部分。这个属性被用来监测文本的变化。CheckBox IsChecked{Binding ElementNametBox, Path(local:TextBoxHelper.HasText)} FontSize30这是一个复选框控件其中包含了数据绑定。 IsChecked{Binding ...}这部分指示IsChecked属性将被绑定到某个数据源。ElementNametBox这是一个Binding的设置指定了数据源是哪个控件即名为tBox的TextBox控件。Path(local:TextBoxHelper.HasText)这是Binding的路径设置。告诉WPF应用程序查找名为tBox的控件并在该控件上查找名为HasText的属性。这个属性用于确定TextBox中是否有文本。 关于这些概念的详细解释 ElementName这是一个Binding设置用于指定绑定的数据源控件的名称。在示例中数据源是名为tBox的TextBox。Path这是用于指定数据源控件上的属性或属性路径的设置。在这里你正在查找名为HasText的属性该属性被用于确定CheckBox的IsChecked属性。(local:TextBoxHelper.HasText)这种写法通常用于引用附加属性其中local表示当前命名空间TextBoxHelper是一个附加属性的名称而HasText是这个附加属性的属性名。 这种绑定方式可以用于将一个控件的属性绑定到另一个控件的属性使它们保持同步例如在文本框中输入文本时相关的复选框的选中状态也会相应地改变。这种绑定通常用于实现界面元素之间的交互和数据同步。 e.NewValue解释 e.NewValue 是一个 DependencyPropertyChangedEventArgs 对象的属性它用于存储关于依赖属性更改的信息。 含义e.NewValue 表示在依赖属性更改时属性的新值。当一个依赖属性的值发生变化时e.NewValue 将包含新值以便可以在事件处理程序中访问并使用它。作用e.NewValue 主要用于在属性更改事件处理程序中获取属性的新值。它允许在属性值发生变化时采取相应的操作。例如可以根据新值来更新界面元素、执行计算或触发其他操作。类型e.NewValue 的类型取决于被监测属性的类型。它是一个 object 类型因为它需要能够表示任何类型的值。通常需要将其转换为适当的类型以便在代码中使用。这个类型转换通常是基于知道将要更改的属性的类型。例如在上述代码示例中似乎假定属性的新值是一个布尔值。 在提供的代码示例中if ((bool)e.NewValue) 的作用是检查某个依赖属性的新值是否为 true以决定是否执行特定的操作。这是一个典型的用例其中 e.NewValue 用于确定如何响应属性的更改。
http://www.hkea.cn/news/14267228/

相关文章:

  • 浙江省建设工程检测协会网站个人网站名称举例
  • 怎么做网站布局网站建设中页面模板下载
  • 做一款什么网站赚钱电商怎么做的步骤
  • 东莞凤岗企业网站建设推广网站流量分析网站
  • 天津百度网站快速排名中国五大门户网站
  • 大连网站建设报价关于网站建设的教材
  • 沈阳哪家做网站好做网站水晶头
  • 易讯企业建站系统做网站所需要的公司细责及条款
  • 虚拟网站怎么做的深圳微信网站设计
  • com后缀的网站wordpress威廉希尔插件
  • 悉知网站建设网店推广平台
  • 有哪些做婚品的网站网站开发设计概述
  • 免费建站哪个网站最好网站域名和网址一样吗
  • 邯郸移动网站制作旅游网站建设成都
  • 优化门户网站建设上海国际人力资源开发公司
  • 深圳做网站优化的公司兰亭集势网站模板
  • 网站的推广运营旺道seo优化软件
  • 网站下载服务器配置男人和女人做污的视频网站
  • 站酷网素材苏州北京商场网站建设
  • 个人制作的网站模板seo研究中心培训机构
  • 西安莲湖区建设局网站玉田网站制作
  • app开发网站开发扬州工程建设信息网官网
  • 豪华网站设计网站推广总结
  • 15年做啥网站能致富万网云虚拟主机上传网站吗
  • 黑龙江做网站公司新乡中企网站建设
  • 建设网站的分析报告wordpress 显示word文档
  • 杭州做网站怎么收费大良制作网站
  • 钱建网站卡盟网站制作教程
  • 中国国家建设部网站wordpress主体上传
  • 公司网站设计与管理做环卫车怎么做网站