[英]Visual Studio 2022 winform designer does not show ApplicationSettings in the property window of any control
In VS 2022 I create a new winform (.net 6.0) project.在 VS 2022 中,我创建了一个新的 winform (.net 6.0) 项目。 I put one textbox on the form.我在表格上放了一个文本框。 In the properties window, at the top, I'm used to seeing an item "ApplicationSettings" where I can bind the TEXT property of the textbox to an application setting.在属性 window 中,在顶部,我习惯于看到一个项目“ApplicationSettings”,我可以在其中将文本框的 TEXT 属性绑定到应用程序设置。 But I no longer see the line for "ApplicationSettings".但我不再看到“ApplicationSettings”这一行。 If I open an older winform project it works as expected.如果我打开一个较旧的 winform 项目,它会按预期工作。
The feature is (still) not available for WinForms .NET 6 but if you create a WinForms .NET framework project, it's available.该功能(仍然)不适用于 WinForms .NET 6,但如果您创建 WinForms .NET 框架项目,它就可用。
As a workaround, you can create the Application Settings yourself and add a user-scoped property like Property1
, then setup a databinding in code, like this:作为一种解决方法,您可以自己创建应用程序设置并添加一个用户范围的属性,如Property1
,然后在代码中设置数据绑定,如下所示:
this.textBox1.DataBindings.Add(new Binding("Text",
Properties.Settings.Default, "Property1", true,
DataSourceUpdateMode.OnPropertyChanged));
This worked for me, for the Visual Studio Community Version:这对我有用,适用于 Visual Studio 社区版本:
Hope this helps!希望这可以帮助!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.