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

本溪网站制作小视频关键词汇总

本溪网站制作,小视频关键词汇总,重庆璧山网站建设,网站开发风险1.1 命名规则 Aview 对应 AVIewModel, 文件夹 views 和 viewmodels 1.2 需要注册服务 //RootViewModel是主窗口 public class Bootstrapper : Bootstrapper<RootViewModel>{/// <summary>/// 配置IoC容器。为数据共享创建服务/// </summary…

1.1 命名规则   Aview 对应  AVIewModel,       文件夹  views  和    viewmodels

1.2 需要注册服务

//RootViewModel是主窗口

public class Bootstrapper : Bootstrapper<RootViewModel>{/// <summary>///     配置IoC容器。为数据共享创建服务/// </summary>/// <param name="builder"></param>protected override void ConfigureIoC(IStyletIoCBuilder builder){builder.Bind<SharedDataService>().ToSelf().InSingletonScope();builder.Bind<AddCategoryViewModel>().ToSelf();}

 2 主窗口打开子窗口  如:RootViewModel==>AddCategoryViewModel   

命令绑定方式:   Command="{s:Action OpenWindowAction}"

public RootViewModel _rootViewModel ;
private IWindowManager _windowManager;public RootViewModel(IWindowManager windowManager,SharedDataService sharedService)
{_windowManager = windowManager;EditContent =  new();_rootViewModel = this;_sharedService = sharedService;_sharedService.CategoryNameChanged += OnCategoryAdded;}  public void OpenWindowAction(object commandParameter){_windowManager.ShowWindow(new AddCategoryViewModel(_sharedService));  //打开子窗口}//xaml :
<Button Content="&#xe650;"Command="{s:Action OpenWindowAction}"FontFamily="{StaticResource IconFont}"FontSize="20"Foreground="{DynamicResource TextIconBrush}"Style="{StaticResource ButtonCustom}" />

3 窗口通信 , 注册服务 如上1.2:   

 private readonly SharedDataService _sharedService= new(); public NoteContentModel _noteContentModel = new();public RootViewModel(IWindowManager windowManager,SharedDataService sharedService)
{_windowManager = windowManager;EditContent =  new();_rootViewModel = this;_sharedService = sharedService;_sharedService.CategoryNameChanged += OnCategoryAdded;//监听共享数据服务事件}  /// <summary>///  共享数据服务.///  <para>如果跨线程修改数据(异步,多线程),需通过 ///  Execute.OnUIThread(() => SharedValue = "新值");</para>///  /// </summary>
public  class SharedDataService: PropertyChangedBase
{private string _CategoryName;public string CategoryName{get { return _CategoryName; }set { SetAndNotify(ref _CategoryName, value);CategoryNameChanged?.Invoke(value); // 触发事件 }}/// <summary>///  分类名称发生变化事件./// </summary>public event Action<string> CategoryNameChanged;

子窗口代码

 public partial class AddCategoryViewModel : Screen{private readonly SharedDataService _sharedService;public AddCategoryViewModel() { }// 通过构造函数注入 public AddCategoryViewModel(SharedDataService sharedService){_sharedService = sharedService;}private string _categoryName;public string CategoryName{get => _categoryName;set => SetAndNotify(ref _categoryName, value);}// 使用 Stylet 的 RelayCommand 替代 System.Windows.Input public RelayCommand WinClosedCommand => new RelayCommand((o) =>{// 更新共享数据 _sharedService.CategoryName = CategoryName;((HC.PopupWindow)o).Close();关闭窗口(Stylet 标准方式)//this.RequestClose(true);});}

<hc:Window x:Class="ProgramNotes.Views.AddCategoryView"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:hc="https://handyorg.github.io/handycontrol"xmlns:local="clr-namespace:ProgramNotes.Views"xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"xmlns:vm="clr-namespace:ProgramNotes.ViewModels"xmlns:i="http://schemas.microsoft.com/xaml/behaviors"xmlns:s="https://github.com/canton7/Stylet"Width="300"Height="50"d:DataContext="{d:DesignInstance Type=vm:AddCategoryViewModel}"AllowsTransparency="True"ShowInTaskbar="False"ShowTitle="False"BorderThickness="1"Background="{StaticResource WindowBrush}" WindowStartupLocation="CenterScreen"WindowStyle=" None"mc:Ignorable="d"><Grid Margin="8"><hc:SimplePanel ><TextBlock Margin="0"HorizontalAlignment="Left"VerticalAlignment="Center"Text="新的类别名称 " /><TextBox HorizontalAlignment="Stretch"Height="28"Text="{Binding CategoryName, Mode=TwoWay}"Margin="75,0 50 0"/></hc:SimplePanel><Button Grid.Row="0"Grid.Column="1"Margin="0"Style="{StaticResource ButtonPrimary}"Command="{Binding WinClosedCommand }"CommandParameter="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type hc:Window}}}"HorizontalAlignment="Right"VerticalAlignment="Center"Height="26"Content="确定" ></Button></Grid>
</hc:Window>

http://www.dtcms.com/wzjs/29006.html

相关文章:

  • 威客做的比较好的网站有哪些营销案例100例小故事
  • 头条新闻今日头条app下载整站优化服务
  • 连云港网站建设wang品牌广告投放
  • 直播软件下载网站个人网页生成器
  • 购物网站 页面设计北京seo优化wyhseo
  • 抖音代刷网站推广快速教育培训网站官网
  • 网站建设培训哪家好网站seo重庆
  • 网站logo在哪里修改搜索引擎分哪三类
  • 深圳网站建设 套餐营销顾问公司
  • 简洁企业网站模板抖音seo搜索引擎优化
  • 粉丝经济日渐蓬勃安徽网站seo公司
  • 定制小程序开发公司seo优化教程自学
  • 菠菜网站开发csjylw网络推广外包公司
  • 网站建设贝尔利个人免费推广网站
  • 安徽网站开发公司百度爱采购关键词优化
  • 竞拍网站做烂了怎么注册自己的网站域名
  • ps做网站首页的尺寸杨谦教授编的营销课程
  • 国内做彩票网站违法么24小时自助下单平台网站便宜
  • 做网站知识点提升seo搜索排名
  • 网站运行环境配置国外网站推广公司
  • 建立什么网站赚钱百度高级搜索指令
  • 网站建设做的人多吗北京百度seo排名
  • 视觉中国网站福州短视频seo方法
  • 外贸网站建设是什么关键词提取
  • 门户网站的建设公司外贸网站seo
  • 新开发的网站怎么做测试网络广告策划案
  • 北京网络网站建设公司桌面百度
  • 郑州七彩网站建设公司 评论百度推广账户优化方案
  • 网站程序 制作国际新闻最新消息十条
  • 湖北省建设厅信息网站seo美式