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

网站建设商标在哪个类别百度关键词seo优化

网站建设商标在哪个类别,百度关键词seo优化,做酒水网站陕西有哪些,学习网站建设与管理工业控制中,经常会需要把一个bool 型输入信号的状态显示在面板上,使用wpf 绑定的办法,可简洁实现: 实现步骤: 1,定义类: 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();}}}

3,xml 实现:

<Window x:Class="WpfAppBoolBinding.MainWindow"xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"xmlns:d="http://schemas.microsoft.com/expression/blend/2008"xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"xmlns:local="clr-namespace:WpfAppBoolBinding" mc:Ignorable="d"Title="MainWindow" Height="450" Width="800"><Window.Resources><local:BooleanToBrushConverter x:Key="BooleanToBrushConverter"/></Window.Resources><Grid><StackPanel HorizontalAlignment="Center" VerticalAlignment="Center"><Ellipse Width="50" Height="50" Fill="{Binding MainView.MyProperty, Converter={StaticResource BooleanToBrushConverter}}" Margin="10,30"/><Button Content="变换颜色" Width="60" Height="30" Click="Button_Click" Margin="10,30"/></StackPanel></Grid>
</Window>

4,进行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 的交互逻辑/// </summary>public 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/396944/

相关文章:

  • 行业门户网站开发百度竞价怎么做效果好
  • 适合前端做项目的网站百度网盘搜索
  • 下载网站怎么下载广州网站定制多少钱
  • 西安攻略旅游自由行怎么玩北京seo软件
  • 汉川网站建设sem代运营
  • 装酷网装修平台东莞seo外包
  • 专门做图片的网站吗如何建网站要什么条件
  • 卢氏县住房和城乡建设局网站站长统计 站长统计
  • 济南 网站制作旺道营销软件
  • 新上线网站如何做搜索引擎站长素材网站
  • 做网站编辑深圳疫情防控最新消息
  • PHP网站开发项目式教程google下载手机版
  • 国外专门用于做网站图片的做网站要多少钱
  • 网站维护费用计入什么科目媒介星软文平台官网
  • 网站建设seo 视频做网站哪个平台好
  • 旅行社网站建设方案论文百度seo公司
  • 长沙网站建设与维护百度开户联系方式
  • 做pcr查基因序列的网站南京百度网站快速优化
  • 数据服务网站策划方案关键词快速优化排名软件
  • 响应式网站缺点学大教育培训机构电话
  • 江苏天德建设工程有限公司网站一个平台怎么推广
  • 石家庄做网络推广的网站推广平台收费标准
  • 贵阳天柱网站建设招聘域名注册平台有哪些
  • 网站建设电话营销百度问一问官网
  • 网站优化建设河南怎么关闭seo综合查询
  • 自贡做响应式网站开发公司google搜索引擎入口google
  • 东莞哪种网站推广好微信朋友圈推广文案
  • 现在学做网站赚钱吗东莞市优速网络科技有限公司
  • 宁津做网站公司宣传推广图片
  • 陕西的建设厅官方网站数据分析报告