bindingtoctrl.xaml.cs
来自「学习WPF的好东西」· CS 代码 · 共 37 行
CS
37 行
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
namespace DTSample
{
public partial class BindingToCtrl : System.Windows.Window
{
public BindingToCtrl()
{
InitializeComponent();
}
BindingClass BindPath = new BindingClass("I'm a textBox", 100);
private void Onload(Object sender, EventArgs e)
{
MyTextBox.DataContext = BindPath;
MyTextBlock.DataContext = BindPath;
}
private void OnClick(object sender, RoutedEventArgs e)
{
BindingExpression be = MyTextBox.GetBindingExpression(TextBox.TextProperty);
be.UpdateSource();
}
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?