【问题标题】:Silverlight version not display in Listbox WPFSilverlight 版本不显示在列表框 WPF 中
【发布时间】:2015-01-29 11:57:18
【问题描述】:

谁能帮我解决问题。

当我运行它时,它会显示一个空白列表框我想如何显示。只有银光版。

谢谢。

private void GetSilverLightInstall()
{
    string uninstallKey = @"SOFTWARE\Microsoft\Silverlight\Version";

    using (RegistryKey rk = Registry.LocalMachine.OpenSubKey(uninstallKey))
    {
        foreach (string skName in rk.GetSubKeyNames())
        {
            using (RegistryKey sk = rk.OpenSubKey(skName))
            {
                 lsitBox1.Items.Add(sk.GetValue("DisplayName"));
            }
        }
    }
}

【问题讨论】:

    标签: c# wpf xaml registry


    【解决方案1】:

    在我的系统上,Version 是一个字符串值,而不是一个键。因此,以下对我有用:

    var keyName = @"SOFTWARE\Microsoft\Silverlight";
    
    using (var regKey = Registry.LocalMachine.OpenSubKey(keyName))
    {
        var version = regKey.GetValue("Version") as string;
    
        Debug.WriteLine(version);
    }
    

    【讨论】:

      猜你喜欢
      • 2015-09-08
      • 2010-10-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多