Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我只是想知道在需要时如何处理常量?后面的代码是否只是用于将它们存储在资源字典中?
在 wpf 中编码时通常如何存储设置和首选项?
您也可以像这样在 xaml 中声明它们(如果您正在考虑这样的事情):
<Grid.Resources> <system:String x:Key="myConstant">600</system:String> </Grid.Resources>
然后将其用作一个StaticResource,例如{StaticResource myConstant}
StaticResource
{StaticResource myConstant}