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]

  • 相关阅读:
    关于禁用发布可能出现的问题处理
    SQL Server数据库的整理优化的基本过程(一)
    分享SQL2005分区实现教程
    Oracle数据库的测试用户Scott的密码为什么是Tiger?
    这就是传说中的搜狗浏览器2.0
    IE6,IE7下双倍边距续
    IE7下fload:left造成双倍边距BUG
    as2和as3之间交互
    倒计时效果
    js拖动层效果
  • 原文地址:https://www.cnblogs.com/BeeSnow/p/7922710.html
Copyright © 2011-2022 走看看