我有一个带有标签的客户用户控件TextBox(Border包裹在 aLabel和 aTextBox上,TextBox标签重叠)。我找到了几个(工作)示例,说明如何在TextChanged从我的 UserControl 调用该函数时使其工作。
只是文本框片段:
<TextBox
FontSize="{Binding Path=DefaultFontSize}"
Style="{StaticResource WatermarkTextBox}"
Padding="{Binding Path=TextPadding}"
Tag="{Binding Path=TextValue}"
/>
我尝试过RoutedEventHandler像我对按钮的 Click 事件一样使用,但它没有用。我如何得到它,所以当我说我在窗口上使用它时,它是必需的:
<MyControl:LabeledTextBox
TextBoxChange="Some_Event"
TextValue="{Binding SomethingOrOther}"
/>
它将正确启动并执行所需的功能