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

影响网站权重企业网站建设套餐 网络服务

影响网站权重,企业网站建设套餐 网络服务,手机ui界面设计,富阳建设局网站工业控制中#xff0c;经常会需要把一个bool 型输入信号的状态显示在面板上#xff0c;使用wpf 绑定的办法#xff0c;可简洁实现#xff1a; 实现步骤#xff1a; 1#xff0c;定义类#xff1a; using System; using System.Collections.Generic; using System.Com…工业控制中经常会需要把一个bool  型输入信号的状态显示在面板上使用wpf 绑定的办法可简洁实现 实现步骤 1定义类 using System; using System.Collections.Generic; using System.ComponentModel; using System.Linq; using System.Runtime.CompilerServices; using System.Text; using System.Threading.Tasks;namespace WpfAppBoolBinding {public class MainViewModel : INotifyPropertyChanged{private bool _myProperty;public bool MyProperty{get { return _myProperty; }set{if (_myProperty ! value){_myProperty value;OnPropertyChanged();}}}public event PropertyChangedEventHandler PropertyChanged;protected virtual void OnPropertyChanged([CallerMemberName] string propertyName ){if (this.PropertyChanged ! null){this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName));}}}public class TestViewModel{public MainViewModel MainView { get; set; }public int couter { get; set; }} }2定义bool  类型转换器 using System; using System.Collections.Generic; using System.Globalization; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Data; using System.Windows.Media;namespace WpfAppBoolBinding {[ValueConversion(typeof(bool), typeof(Brush))]public class BooleanToBrushConverter : IValueConverter{public object Convert(object value, Type targetType, object parameter, CultureInfo culture){return (bool)value ? Brushes.Green : Brushes.Red;}public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture){throw new NotImplementedException();}}}3xml 实现 Window x:ClassWpfAppBoolBinding.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:WpfAppBoolBinding mc:IgnorabledTitleMainWindow Height450 Width800Window.Resourceslocal:BooleanToBrushConverter x:KeyBooleanToBrushConverter//Window.ResourcesGridStackPanel HorizontalAlignmentCenter VerticalAlignmentCenterEllipse Width50 Height50 Fill{Binding MainView.MyProperty, Converter{StaticResource BooleanToBrushConverter}} Margin10,30/Button Content变换颜色 Width60 Height30 ClickButton_Click Margin10,30//StackPanel/Grid /Window4进行Datacontex 绑定 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 WpfAppBoolBinding {/// summary/// MainWindow.xaml 的交互逻辑/// /summarypublic partial class MainWindow : Window{TestViewModel testViewModel new TestViewModel();public MainWindow(){InitializeComponent();testViewModel.MainView new MainViewModel();DataContext testViewModel;}private void Button_Click(object sender, RoutedEventArgs e){testViewModel.MainView.MyProperty !testViewModel.MainView.MyProperty;}} }
http://www.hkea.cn/news/14350330/

相关文章:

  • 汕头模板自助建站分析建设网站的可行性
  • 农业网站平台建设方案平面设计培训班价格
  • 商城网站建设开发多少钱九一制作网站
  • 合作网站制作竞价单页
  • php网站屏蔽词怎么做产品如何做网站地图
  • 东莞合网站建设WordPress屏蔽cn国家访问
  • notepad做网站技巧硬件工程师需要学哪些
  • 营销型网站教程wordpress 标签搜索
  • 网站一屏做多大五年级下册数学优化设计答案
  • 有域名怎么建设网站用vue-cli做的网站
  • 河南网站网站制作wordpress 标签云制作
  • 最专业的企业营销型网站建设价格石家庄免费做网站
  • 2017两学一做网站网店设计作用有哪些
  • 网站开发内容怎么写南京制作网站
  • 网站建设很简单百度浏览器app
  • 微网站页面菜单栏如何自己做解析网站
  • 做的好的有哪些网站云畅网站建设后台
  • 博物建设公司网站如今做那个网站致富
  • 动漫网站logo企业网站怎么做排名
  • wordpress国内网站网络营销网站 功能
  • 做不做生意都要知道的网站新注册的公司怎么做网站
  • 深圳建站工作室wordpress中如何添加面包屑
  • 电影网站开发现状推广普通话宣传内容
  • 上海网站建设不好苏州微信网站建设
  • 帮做钓鱼网站会怎样wordpress博客百度收录
  • 自己编写网站wordpress 调用文章摘要
  • 山东专业网站建设公司哪家好鞍山玉佛苑玉佛图片
  • 唐山市做网站几种语言的网站如何做
  • 做网站 学什么重要新闻头条
  • 2016做网站百度号码认证平台个人号码申诉