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

苏州哪家做网站好些推广之家app

苏州哪家做网站好些,推广之家app,辽宁建设工程信息网查询官网,关键词竞价排名名词解释为了确保的新 ViewModel 不会影响现有绑定到 MainViewModel 的其他属性#xff0c;可以使用 MonitorPage 作为 UserControl 的局部 DataContext#xff0c;而不覆盖整个 UserControl 的 DataContext。可以通过在 XAML 中的某个局部范围内#xff08;如包含时间显示的 TextBl…为了确保的新 ViewModel 不会影响现有绑定到 MainViewModel 的其他属性可以使用 MonitorPage 作为 UserControl 的局部 DataContext而不覆盖整个 UserControl 的 DataContext。可以通过在 XAML 中的某个局部范围内如包含时间显示的 TextBlock设置局部 DataContext 来实现。 具体步骤如下 1. **不要在整个 UserControl 设置 DataContext**而是在需要显示时间的 TextBlock 上设置局部 DataContext。 2. **保留原有的 DataContext**这样其他绑定会继续使用 MainViewModel。 ### 修改后的 XAML 在包含时间显示的 TextBlock 上设置局部 DataContext如下所示 xml UserControl x:ClassZhaoxi.DigitaPlatform.Views.Pages.MonitorPage              xmlnshttp://schemas.microsoft.com/winfx/2006/xaml/presentation              xmlns:xhttp://schemas.microsoft.com/winfx/2006/xaml              xmlns:mchttp://schemas.openxmlformats.org/markup-compatibility/2006               xmlns:dhttp://schemas.microsoft.com/expression/blend/2008               xmlns:localclr-namespace:Zhaoxi.DigitaPlatform.Views.Pages              xmlns:lvcclr-namespace:LiveCharts.Wpf;assemblyLiveCharts.Wpf              xmlns:zxcclr-namespace:Zhaoxi.DigitaPlatform.Components;assemblyZhaoxi.DigitaPlatform.Components              xmlns:cclr-namespace:Zhaoxi.DigitaPlatform.Common.Converter;assemblyZhaoxi.DigitaPlatform.Common              xmlns:sysclr-namespace:System;assemblymscorlib              mc:Ignorabled               d:DesignHeight750 d:DesignWidth1300 UserControl.Resources         !-- Your existing resources --     /UserControl.Resources          !-- Your existing layout --     Grid Margin80,10,10,10         Grid.ColumnDefinitions             ColumnDefinition Width250/             ColumnDefinition/             ColumnDefinition Width250/         /Grid.ColumnDefinitions !-- 第一列 --         Grid             Grid.RowDefinitions                 RowDefinition Height90/                 RowDefinition/             /Grid.RowDefinitions             !-- 第一块 --             Border CornerRadius6                 Border.Background                     LinearGradientBrush StartPoint0,0 EndPoint0,1                         GradientStop Color#1116a1ff Offset0/                         GradientStop ColorTransparent Offset1/                     /LinearGradientBrush                 /Border.Background             /Border             Grid VerticalAlignmentTop Margin0,10                 !-- Your existing layout --             /Grid                          !-- 在这里设置局部 DataContext --             TextBlock VerticalAlignmentBottom HorizontalAlignmentCenter Margin0,0,0,15                        Foreground#555 Nametxt_time                 TextBlock.DataContext                     local:MonitorPageViewModel /                 /TextBlock.DataContext                 Run Text{Binding CurrentTime, ModeOneWay, StringFormatHH:mm:ss} FontFamily{StaticResource DigitalDisplay} FontSize30/                 Run Text   /                 Run Text{Binding CurrentTime, ModeOneWay, StringFormatdddd, ConverterCulturezh-CN} FontSize13/             /TextBlock                          !-- Other elements --         /Grid         !-- Other columns --     /Grid /UserControl ### ViewModel 实现 保持 MonitorPageViewModel 和之前一样 csharp using System; using System.ComponentModel; using System.Runtime.CompilerServices; using System.Windows.Threading; public class MonitorPageViewModel : INotifyPropertyChanged {     private DateTime _currentTime;     private DispatcherTimer _timer; public MonitorPageViewModel()     {         _currentTime DateTime.Now;         _timer new DispatcherTimer();         _timer.Interval TimeSpan.FromSeconds(1);         _timer.Tick (s, e) CurrentTime DateTime.Now;         _timer.Start();     } public DateTime CurrentTime     {         get _currentTime;         set         {             _currentTime value;             OnPropertyChanged();         }     } public event PropertyChangedEventHandler PropertyChanged; protected void OnPropertyChanged([CallerMemberName] string name null)     {         PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(name));     } } ### 总结 通过上述方法可以仅在需要的 TextBlock 上设置局部 DataContext这样不会影响 UserControl 的全局 DataContext并且可以保留原本绑定到 MainViewModel 的其他属性。
http://www.zqtcl.cn/news/360762/

相关文章:

  • 没有备案的网站怎么做淘宝客html5开发手机网站
  • 酒店旅游团购网站建设推广普通话实践总结
  • 基本的网站开发技术路线建设网站的好处有哪些
  • 网站排行怎么做wordpress all in one seo插件
  • 河北特定网站建设推荐wordpress添加vip用户组
  • 北京商城网站建设地址asp.net网站开发 pdf
  • 如何用网页制作网站龙岩门户网站
  • 中国建设银行官网站下载建设网站弹出后加载不进去
  • 广告网站制作多少钱建设工程合同甲方
  • 一号网站建设誉重网站建设
  • 网站seo优化查询网站开发最合适的搭配
  • 做文员的网站知乎qq小程序怎么打开
  • 网站外链建设分析wordpress生成验证码发送代码
  • 网站设计与制作的过程珠海网站建设 旭洁科技
  • 网站建设项目经费的报告轻创网
  • 青岛网站建设制作软件开发培训学校排行
  • pk10网站怎么做网站建设名词
  • 秦皇岛哪有网站优化公司wordpress看图插件
  • ps做网站宽度想做个网站要多少钱
  • 马克斯网站建设外贸电商平台哪个网站最好
  • 国外网站做任务套利网络推广员怎么做
  • 如何创建一个网站用来存放东西wordpress 可以干嘛
  • 做健身俱乐部网站的目的和意义商超网站
  • 网站点击排名phpcms安装
  • 鹧鸪哨网站1v1深度开发最吸引人的营销广告文案
  • 网站建设可以学吗如何修改wordpress的登录
  • 保定做网站的公司百度软件商店
  • 金华市金东区建设局网站wordpress好看的下载页面
  • 英文网站seo发展前景成都网站开发建设推广
  • p2p网贷网站建设方案制作网站专业公司吗