本文整理汇总了C#中TextBox.Bind方法的典型用法代码示例。如果您正苦于以下问题:C# TextBox.Bind方法的具体用法?C# TextBox.Bind怎么用?C# TextBox.Bind使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TextBox
的用法示例。
在下文中一共展示了TextBox.Bind方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Typing_Beginning_With_0_Should_Not_Modify_Text_When_Bound_To_Int
public void Typing_Beginning_With_0_Should_Not_Modify_Text_When_Bound_To_Int()
{
using (UnitTestApplication.Start(Services))
{
var source = new Class1();
var target = new TextBox
{
DataContext = source,
Template = CreateTemplate(),
};
target.ApplyTemplate();
target.Bind(TextBox.TextProperty, new Binding(nameof(Class1.Foo), BindingMode.TwoWay));
Assert.Equal("0", target.Text);
target.CaretIndex = 1;
target.RaiseEvent(new TextInputEventArgs
{
RoutedEvent = InputElement.TextInputEvent,
Text = "2",
});
Assert.Equal("02", target.Text);
}
}
示例2: Build
protected virtual void Build()
{
this.ResetTabIndex();
this.AutoSize = Squid.AutoSize.Vertical;
this.Dock = DockStyle.Top;
_textBox = this.AddLabeledTextBox(100, "Name:");
_textBox.Bind(this.GameObject, "Name");
}
示例3: Indei_Should_Set_ValidationState
public void Indei_Should_Set_ValidationState()
{
using (UnitTestApplication.Start(TestServices.MockThreadingInterface))
{
var target = new TextBox();
var binding = new Binding(nameof(ExceptionTest.LessThan10));
binding.Source = new IndeiTest();
binding.EnableValidation = true;
target.Bind(TextBox.TextProperty, binding);
Assert.True(target.ValidationStatus.IsValid);
target.Text = "20";
Assert.False(target.ValidationStatus.IsValid);
target.Text = "1";
Assert.True(target.ValidationStatus.IsValid);
}
}