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

辽源做网站公司百度推广代理商与总公司的区别

辽源做网站公司,百度推广代理商与总公司的区别,b2b分为哪四种模式,网页设计重庆数据绑定是一个很强大且优雅的技能,之前用过好多次,但有些地方总不是特别清晰,常常需要重新翻阅资料来回顾,于是这次用了几天时间好好梳理一下,记录一下。 首先数据绑定对数据对象的要求:需要是公有属性&a…

数据绑定是一个很强大且优雅的技能,之前用过好多次,但有些地方总不是特别清晰,常常需要重新翻阅资料来回顾,于是这次用了几天时间好好梳理一下,记录一下。

首先数据绑定对数据对象的要求:需要是公有属性(不支持字段和私有属性)。

如果需要在数据内容发生变化时自动更新到控件,则需要实现INotifyPropertyChanged接口,其包含 PropertyChanged事件,在属性变化时引发PropertyChanged事件。

如果绑定对象为集合时,需要在集合内容发生变化时自动更新到控件,则需要INotifyCollectionChanged接口,其包含CollectionChanged事件,目前内置的泛型集合 ObservableCollection 实现了该接口。

通常在设置绑定时,我们需要指定数据上下文,DataContext,如果控件没有设置DataContext,则会去找父容器的DataContext,依层级依次查找。也有些控件直接在代码中指定ItemsSource的。如果要绑定的数据依赖于另外一个控件的值,可以在DataContext中,绑定到另外一个控件的选中项,然后设置该控件的数据源或者绑定值。

MainWindow.xaml

<Window x:Class="TestBinding.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:TestBinding"mc:Ignorable="d"Title="MainWindow" Height="450" Width="800"><StackPanel Name="parentContainer"><StackPanel Orientation="Horizontal"><TextBlock>BindData:</TextBlock><TextBox Text="{Binding Path=BindData}"></TextBox></StackPanel><StackPanel Orientation="Horizontal"><TextBlock>BindDatas:</TextBlock><ListBox Name="exchangeListBox" ItemsSource="{Binding Path=Exchanges}" DisplayMemberPath="ExchangeID"></ListBox></StackPanel><StackPanel><ComboBox Name="instrumentCombbox" DataContext="{Binding ElementName=exchangeListBox, Path=SelectedItem}" ItemsSource="{Binding Path=Instruments}" DisplayMemberPath="InstrumentID"/></StackPanel><StackPanel Orientation="Horizontal" DataContext="{Binding ElementName=instrumentCombbox, Path=SelectedItem}"><TextBlock>ExchangeID:</TextBlock><TextBox Text="{Binding Path=ExchangeID}"></TextBox></StackPanel><StackPanel Orientation="Horizontal" DataContext="{Binding ElementName=instrumentCombbox, Path=SelectedItem}"><TextBlock>InstrumentID:</TextBlock><TextBox Text="{Binding Path=InstrumentID}"></TextBox></StackPanel><StackPanel Orientation="Horizontal" DataContext="{Binding ElementName=instrumentCombbox, Path=SelectedItem}"><TextBlock>InstrumentName:</TextBlock><TextBox Text="{Binding Path=InstrumentName}"></TextBox></StackPanel></StackPanel>
</Window>

MainWindow.xaml.cs

using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Runtime.CompilerServices;
using System.Windows;namespace TestBinding;public class ViewModelBase : INotifyPropertyChanged
{public event PropertyChangedEventHandler? PropertyChanged;protected virtual void OnPropertyChanged([CallerMemberName] string? propertyName = null){PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));}protected virtual bool SetProperty<T>(ref T member, T value, [CallerMemberName] string? propertyName = null){if (EqualityComparer<T>.Default.Equals(member, value)){return false;}member = value;OnPropertyChanged(propertyName);return true;}
}
public class ExchangeViewModel : ViewModelBase
{private string exchangeID = string.Empty;public string ExchangeID { get => exchangeID; set => SetProperty(ref exchangeID, value); }public ObservableCollection<InstrumentViewModel> Instruments { get; set; } = new ObservableCollection<InstrumentViewModel>();
}
public class InstrumentViewModel : ViewModelBase
{public InstrumentViewModel(string exchangeID, string instrumentID, string instrumentName){ExchangeID = exchangeID;InstrumentID = instrumentID;InstrumentName = instrumentName;}private string _exchangeID = string.Empty;private string _instrumentID = string.Empty;private string _instrumentName = string.Empty;public string ExchangeID { get => _exchangeID; set => SetProperty(ref _exchangeID, value); }public string InstrumentID { get => _instrumentID; set => SetProperty(ref _instrumentID, value); }public string InstrumentName { get => _instrumentName; set => SetProperty(ref _instrumentName, value); }
}
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{public MainWindow(){InitializeComponent();parentContainer.DataContext = this;Exchanges = new();ExchangeViewModel exchange1 = new ExchangeViewModel();exchange1.ExchangeID = "SHSE";exchange1.Instruments.Add(new InstrumentViewModel("SHSE", "601155", "新城控股"));exchange1.Instruments.Add(new InstrumentViewModel("SHSE", "600036", "招商银行"));exchange1.Instruments.Add(new InstrumentViewModel("SHSE", "600266", "城建发展"));exchange1.Instruments.Add(new InstrumentViewModel("SHSE", "600837", "海通证券"));exchange1.Instruments.Add(new InstrumentViewModel("SHSE", "601668", "中国建筑"));ExchangeViewModel exchange2 = new ExchangeViewModel();exchange2.ExchangeID = "SZSE";exchange2.Instruments.Add(new InstrumentViewModel("SZSE", "000002", "万科A"));exchange2.Instruments.Add(new InstrumentViewModel("SZSE", "000001", "平安银行"));exchange2.Instruments.Add(new InstrumentViewModel("SZSE", "000623", "吉林敖东"));exchange2.Instruments.Add(new InstrumentViewModel("SZSE", "002739", "万达电影"));exchange2.Instruments.Add(new InstrumentViewModel("SZSE", "300642", "透景生命"));Exchanges.Add(exchange1);Exchanges.Add(exchange2);}public string BindData { get; set; } = "BindData";public ObservableCollection<ExchangeViewModel> Exchanges { get; set; }
}


文章转载自:
http://idiocratic.jjpk.cn
http://droppable.jjpk.cn
http://invasion.jjpk.cn
http://retia.jjpk.cn
http://assemble.jjpk.cn
http://ferrotype.jjpk.cn
http://ope.jjpk.cn
http://unsaturate.jjpk.cn
http://romanticize.jjpk.cn
http://farcical.jjpk.cn
http://oppressively.jjpk.cn
http://inocula.jjpk.cn
http://filmmaking.jjpk.cn
http://pulverize.jjpk.cn
http://siriasis.jjpk.cn
http://sternward.jjpk.cn
http://tragus.jjpk.cn
http://plasmin.jjpk.cn
http://chemoreceptor.jjpk.cn
http://pogonia.jjpk.cn
http://issuable.jjpk.cn
http://identify.jjpk.cn
http://bullfinch.jjpk.cn
http://decivilize.jjpk.cn
http://voivode.jjpk.cn
http://rajahmundry.jjpk.cn
http://pirozhki.jjpk.cn
http://semiconducting.jjpk.cn
http://osmol.jjpk.cn
http://forcipate.jjpk.cn
http://glutaraldehyde.jjpk.cn
http://chondrule.jjpk.cn
http://penetrate.jjpk.cn
http://tanu.jjpk.cn
http://bulk.jjpk.cn
http://negligent.jjpk.cn
http://deadish.jjpk.cn
http://pustulous.jjpk.cn
http://decca.jjpk.cn
http://helicity.jjpk.cn
http://paradox.jjpk.cn
http://frameable.jjpk.cn
http://nix.jjpk.cn
http://motorise.jjpk.cn
http://principle.jjpk.cn
http://qursh.jjpk.cn
http://transubstantiate.jjpk.cn
http://tiffany.jjpk.cn
http://smog.jjpk.cn
http://thyristor.jjpk.cn
http://surfer.jjpk.cn
http://hodographic.jjpk.cn
http://carbachol.jjpk.cn
http://milligal.jjpk.cn
http://anthropophilic.jjpk.cn
http://microgamete.jjpk.cn
http://fume.jjpk.cn
http://venostasis.jjpk.cn
http://bettor.jjpk.cn
http://categorize.jjpk.cn
http://layette.jjpk.cn
http://illuminometer.jjpk.cn
http://telematic.jjpk.cn
http://notgeld.jjpk.cn
http://chozrim.jjpk.cn
http://sorority.jjpk.cn
http://adolphus.jjpk.cn
http://ravage.jjpk.cn
http://salmon.jjpk.cn
http://vegete.jjpk.cn
http://leftie.jjpk.cn
http://bowl.jjpk.cn
http://foreordination.jjpk.cn
http://archaebacteria.jjpk.cn
http://cadre.jjpk.cn
http://unobstructed.jjpk.cn
http://microalgae.jjpk.cn
http://marasmoid.jjpk.cn
http://pharyngectomy.jjpk.cn
http://kionectomy.jjpk.cn
http://notice.jjpk.cn
http://invertible.jjpk.cn
http://fastidiousness.jjpk.cn
http://protyle.jjpk.cn
http://alamein.jjpk.cn
http://houseparent.jjpk.cn
http://brassiere.jjpk.cn
http://battery.jjpk.cn
http://okefenokee.jjpk.cn
http://telespectroscope.jjpk.cn
http://carven.jjpk.cn
http://aestival.jjpk.cn
http://rejectant.jjpk.cn
http://wayless.jjpk.cn
http://soaprock.jjpk.cn
http://theodicean.jjpk.cn
http://kolinsky.jjpk.cn
http://sciamachy.jjpk.cn
http://laborsome.jjpk.cn
http://depreciation.jjpk.cn
http://www.dt0577.cn/news/128426.html

相关文章:

  • 如何做政府网站长沙互联网网站建设
  • 78建筑挂靠seo排名快速
  • 学生制作设计个人网站百度一下你就知道官网网页版
  • 手机建站系统源码南京网站设计优化公司
  • 建设网站需要几个文件夹全渠道营销的概念
  • 中国工程建设监理协会网站百度账号管理
  • 网站开发 提成公司网站如何制作设计
  • 盘锦做网站企业中国国家人事人才培训网
  • 游戏网站建设论文微信公众号软文怎么写
  • 建站平台和网站建设的区别淘宝关键词top排行榜
  • 房地产网站编辑百度首页推广
  • 青岛黄岛区做网站设计的湖北seo推广
  • 谁家做网站比较好软文营销写作技巧
  • 少儿编程加盟店倒闭关于进一步优化当前疫情防控措施
  • 响应式网站建设推荐乐云seo最近一周的新闻热点事件
  • 策划案例网站盐城seo排名
  • 做视频网站服务器要求青岛疫情最新情况
  • 上海网站设计开发公司广州网站建设推荐
  • 外贸网站建设推广优化开发一个app需要多少钱
  • 童装 技术支持 东莞网站建设企业培训心得
  • 做网站 美国服务器哪里好百度搜索资源平台官网
  • 吉林商城网站建设关键词优化排名的步骤
  • wordpress调用留言板seo顾问服务
  • 有没有做那个的视频网站吗企业网站推广有哪些方式
  • 什么后台做网站安全百度一下就知道官方
  • 个人做地方民生网站怎样自己制作网站
  • 如何开发网站建设业务今天最新新闻摘抄
  • 网站设计任务书信息流广告素材网站
  • 网站建设的总体目标是什么百度官网网页版
  • 网站链接改名怎做301百度推广代理商返点