【发布时间】:2021-10-23 12:45:21
【问题描述】:
我想检查格式 00:00 的 TextBox 中的输入是否匹配。所以我在我的 ViewModel 中创建了一个方法:
private void MinPauseTextChanged(object sender, TextChangedEventArgs args)
{
//check text..
}
我在 XAML 中的绑定如下所示:
<TextBox Grid.Row="0" Grid.Column="1" x:Name="TextBoxSettingMinPause" TextChanged="{Binding Path=MinPauseTextChanged}" Text="{Binding Path=MinPauseSetting}"/>
我总是收到此错误,但我不知道为什么,我按照 Microsoft 网站上的说明进行操作:https://docs.microsoft.com/en-us/dotnet/api/system.windows.controls.textchangedeventargs?view=net-5.0
这是我的错误代码: InvalidCastException:“System.Reflection.RuntimeEventInfo”类型的对象不能隐式转换为“System.Reflection.MethodInfo”。
【问题讨论】:
标签: c# regex wpf events textbox