zoukankan      html  css  js  c++  java
  • WPF 小知识点001

    1.DataGrid 单选事件

     <DataGrid MinHeight="150"
                      AutoGenerateColumns="False"
                      CanUserAddRows="False"
                      IsReadOnly="True"
                      ItemsSource="{Binding DBG_ReserveData}"
                      SelectedItem="{Binding TCmsReserveNet}"
                      SelectionMode="Single">

     <!-- *** -->

    </DataGrid>

    下面文本框中上一级菜单绑定DataSource 或者DataContent 绑定TCmsReserveNet,文本框绑定到里面的属性;

    2.不用SelectedItem

     <i:Interaction.Triggers>
                    <i:EventTrigger EventName="SelectionChanged">
                        <i:InvokeCommandAction Command="{Binding SelectedCmsReserveCommand}" />
                    </i:EventTrigger>
                </i:Interaction.Triggers>

    SelectedCmsReserveCommand:

      public ICommand SelectedCmsReserveCommand
            {
                get
                {
                    return new RelayCommand<string>(parameter =>
                    {
                        if (DBG_ReserveData.CurrentItem != null)
                        {
                            //获取当前选中列
                            t_cms_reserveNet seCmsReserveNet = (t_cms_reserveNet)DBG_ReserveData.CurrentItem;
    
                            fGuestName = seCmsReserveNet.GN;
                            fBeginTime = seCmsReserveNet.BT;
                            fEndTime = seCmsReserveNet.ET;
                            fPhone = seCmsReserveNet.P;
                            fManagerID = seCmsReserveNet.MID;
    
                            fMoneyState = seCmsReserveNet.MS;
                            fNote = seCmsReserveNet.N;
                            fReserveState = seCmsReserveNet.RS;
                            fRoomTypeID = seCmsReserveNet.RTID;
                            fRoomID = seCmsReserveNet.FRID;
    
                            fSubscription = seCmsReserveNet.ST;
                            mTCmsReserve.fReserveID = seCmsReserveNet.RID;
                        }
                    });
                }
            }
    View Code
  • 相关阅读:
    关于Jquery事件绑定的心得
    WEB前端笔记
    Linux文件权限与属性详解 之 ACL
    Linux文件权限与属性详解 之 一般权限
    MarkDown使用教程
    图床神器:七牛云 + Mpic + FScapture
    Python装饰器之 property()
    Python描述符 (descriptor) 详解
    Python魔法方法之属性访问 ( __getattr__, __getattribute__, __setattr__, __delattr__ )
    Python魔法方法总结及注意事项
  • 原文地址:https://www.cnblogs.com/maanshancss/p/5796815.html
Copyright © 2011-2022 走看看