首先添加 mscorlib assembly的命名空间引用

  xmlns:r="clr-namespace:System;assembly=mscorlib"

 XAML代码

<TextBlock>
<Label Content="Operating System Version : "></Label>
<Label Content="{x:Static r:Environment.OSVersion}"></Label>
<LineBreak></LineBreak>
<Label Content="Dot NET Version : "></Label>
<Label Content="{x:Static r:Environment.Version}"></Label>
<LineBreak></LineBreak>
<Label Content="Machine Name : "></Label>
<Label Content="{x:Static r:Environment.MachineName}"></Label>
<LineBreak></LineBreak>
<Label Content="User Name : "></Label>
<Label Content="{x:Static r:Environment.UserName}"></Label>

<LineBreak></LineBreak>
<Label Content="User Domain Name : "></Label>
<Label Content="{x:Static r:Environment.UserDomainName}"></Label>
<LineBreak></LineBreak>
<Label Content="System Directory : "></Label>
<Label Content="{x:Static r:Environment.SystemDirectory}"></Label>

</TextBlock>

 

 

 WPF 中获取系统信息

相关文章:

  • 2021-09-01
  • 2021-05-29
  • 2021-09-25
  • 2021-12-06
  • 2021-09-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-06-07
  • 2021-12-10
  • 2021-11-22
  • 2021-09-23
相关资源
相似解决方案