我有一个带MVVM的C#/ WPF程序.
这两个Kalkulation.Artikel.PartWeight和Kalkulation.Artikel.SprueWeight是小数.两者
的格式应有一个可选的小数位和一个千位分隔符.
每个StringFormat我得到 三个 错误:
Error XLS0112 Expected ''. Kalkulation MainWindow.xaml 113
Error XLS0414 The type '' was not found. Verify that you are not missing an assembly reference and that all referenced assemblies have been built. Kalkulation MainWindow.xaml 113
Error XLS0112 Expected '
Run Code Online (Sandbox Code Playgroud)
当我编译时,我根本没有错误,一切都按预期工作!
当我更改XAML代码时,Errormessages再次弹出.
我已关闭显示文本框之间的同步以轻松输入小数. FrameworkCompatibilityPreferences.KeepTextBoxDisplaySynchronizedWithTextProperty = false;
我该怎么做才能改变这个?我能否至少"过滤"错误消息?
我想简化一些代码.因此,如果某个表格已经打开,我想制作一个检查功能.现在,我的开始表单上的每个按钮后面都有代码.
private void button_parts_Click(object sender, EventArgs e)
{
FormCollection fc = Application.OpenForms;
foreach (Form frm in fc)
{
if (frm is frm_parts) { return; }
}
frm_Teile newForm = new frm_parts();
newForm.Show();
}
Run Code Online (Sandbox Code Playgroud)
现在我希望有类似的东西:
private void button_parts_Click(object sender, EventArgs e)
{
StartNewForm(frm_parts);
}
private void StartNewForm(Type myForm)
{
FormCollection fc = Application.OpenForms;
foreach (Form frm in fc)
{
if (frm is myForm) { return; }
}
myForm newForm = new myForm();
newForm.Show();
}
Run Code Online (Sandbox Code Playgroud)
但我无法将类型传递给函数 编辑:你当然可以,但我不知道如何以及从何处开始.
是否有(另一种)方式来实现我需要的东西?