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]

  • 相关阅读:
    CCF2014123集合竞价(C语言版)
    CCF2016092火车购票
    CCF2013123最大的矩形(C语言版)
    CCF2015122消除类游戏(C语言版)
    CCF2014032窗口(C语言)
    CCF2016093炉石传说(C语言版)
    go module 获取码云私有仓库代码
    centos7 编译安装 redis-6.0.5
    goland2019.2破解方法
    mac下protobuf配置记录
  • 原文地址:https://www.cnblogs.com/BeeSnow/p/7922710.html
Copyright © 2011-2022 走看看