zoukankan      html  css  js  c++  java
  • Wpf学习

    源代码的分支:

    1. properties:程序用到的资源(如:图片,图标,静态的字符串)和配置文件

    2. References(引用):

    3. App.xaml:程序的主体

    4. Windows.xaml:程序的主窗体

    Binding绑定TextBox

                binding binding = new Binding();

                binding.Source = stu;

                binding.Path = new PropertyPath("Name");        //为binding指定访问路径

                BindingOperations.SetBinding(this.textBox1, TextBox.TextProperty, binding);

                //第一个参数:指定binding的目标,第二个参数:为binding指明传达目标的那个属性,第三个参数,binding实例

    控件作为binding源

            <TextBox Text="{Binding ElementName=slider1,Path=Value,Mode=OneWay}" Margin="5"></TextBox>

            <Slider x:Name="slider1" Margin="5"/>

            ------->与以下c#代码等同

            this.textbox.setBinding(TextBox.TextProperty,new Binding("Value") {ElementName="slider1"})

    Mode类型:

            OneWay:单向

            TwoWay:双向

            Default:根据情况而定,如是可编辑(如Textbox.Text属性),默认为TwoWay,如是不可编辑的(TextBlock.Text属性)则默认为单项模式

            OnTime:

            OnWayToSource:

    UpdateSourceTrigger属性

            PropertyChanged:实时改变

            LostFocus:焦点离开后改变

            Explicit:

        

    取TextBox的第3个字符:path=Text[3]

  • 相关阅读:
    Django—使用后台管理Models
    Django—开发具体流程
    Sqlite—数据库管理与表管理
    Sqlite—数据类型
    Python—实现钉钉后台开发
    Xdebug文档(一)基本特性
    FHS定义的Linux目录树
    【转】给Windows + Apache 2.2 + PHP 5.3 安装PHP性能测试工具 xhprof
    【转】UTF-8汉字正则表达式
    【转】Nginx区分PC或手机访问不同网站
  • 原文地址:https://www.cnblogs.com/BeeSnow/p/7922710.html
Copyright © 2011-2022 走看看