WPF/XAML 的开源替代品有哪些? [英] What are the Open Source alternatives to WPF/XAML?

查看:26
本文介绍了WPF/XAML 的开源替代品有哪些?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我们从 HTML/CSS 中学到了什么,那就是声明式语言(如 XML)在描述用户界面方面做得很好,因为:

If we've learned anything from HTML/CSS it's that, declarative languages (like XML) do a good job of describing User Interfaces because:

  1. 构建可以有效地模板化代码的代码预处理器很容易.
  2. 代码采用定义明确且结构良好(理想情况下)的格式,因此易于解析.
  3. 有效解析或抓取基于 XML 的源文件的技术已经存在.
  4. UI 脚本代码变得更加简单易懂.
  5. 设计人员可以自己设计界面,这非常简单.
  6. 程序员不擅长创建 UI,因此对于设计师来说应该足够简单.

我最近查看了 WPF 应用程序的核心部分(即 XAML),它与 HTML 中使用的声明式语言风格非常相似.

I recently took a look at the meat of a WPF application (ie. the XAML) and it looks surprisingly familiar to the declarative language style used in HTML.

桌面 UI 开发的当前状态在很大程度上是碎片化的,否则在图形用户界面设计领域(IE. GTK、XUL、Qt、Winforms、WPF 等)不会有这么多的重复工作.

The current state of desktop UI development is largely fractionalized, otherwise there wouldn't be so much duplicated effort in the domain of graphical user interface design (IE. GTK, XUL, Qt, Winforms, WPF, etc).

仅 Python 就有 45 个 GUI 平台

代表这些特征的开源 GUI 有哪些:

What are some Open Source GUI's that represent these characteristics:

  • 标准化
  • 独立于平台
  • 声明性标记语言
  • 语言不可知

WPF,或更具体地说,XAML 似乎是朝着正确方向迈出的很可能的一步.

WPF, or more specifically XAML seems like a pretty likely step in the right direction.

非常感谢您提供的信息,请继续关注.以下是我从评论和答案中收集到的选项.

Thanks a lot for the info, keep it comin'. Here's are the options I've gathered from the comments and answers.

GladeXML

  • Glade 界面设计师
  • 操作系统平台:所有
  • GUI 平台:GTK+
  • 语言:C (libglade)、C++、C# (Glade#)、Python、Ada、Pike、Perl、PHP、Eiffel、Ruby

XRC(XML 资源)

  • Editors: wxGlade, XRCed, wxDesigner, DialogBlocks (non-free)
  • OS Platforms: All
  • GUI Platform: wxWidgets
  • Languages: C++, Python (wxPython), Perl (wxPerl), .NET (wx.NET)

基于 XML 的格式不是免费的、不是跨平台的或特定于语言的

XUL

  • 编辑器:任何基本的文本编辑器
  • 操作系统平台:运行支持 XUL 的浏览器的任何操作系统
  • GUI 平台:Gecko 引擎?
  • 语言:C++、Python、Ruby 作为插件语言而非基础语言

注意:我不确定 XUL 是否值得在此列表中提及,因为它不是一种桌面 GUI 语言,而是一种 make-webapps-run-on-the-desktop 语言.另外,它需要浏览器才能运行.IE,它是用于桌面的 DHTML".

Note: I'm not sure if XUL deserves mentioning in this list because it's less of a desktop GUI language and more of a make-webapps-run-on-the-desktop language. Plus, it requires a browser to run. IE, it's 'DHTML for the desktop.'

CookSwing

  • Editor: Eclipse via WindowBuilder, NetBeans 5.0 (non-free) via Swing GUI Builder aka Matisse
  • OS Platforms: All
  • GUI Platform: Java
  • Languages: Java only

XAML(月光)

  • MonoDevelop
  • 操作系统平台:仅限 Linux 和其他基于 Unix/X11 的操作系统
  • GUI 平台:GTK+
  • 语言:.NET

注意:XAML 不是纯粹的开源格式,因为 Microsoft 控制着其使用条款,包括随时更改条款的权利.Moonlight 不能合法地在 Windows 或 Mac 上运行.此外,唯一免于法律诉讼的平台是Novell.见这个我的意思的完整描述.XAML 也不是像 C#、Managed C++ 和 CLR 那样的 ECMA 标准.

Note: XAML is not a pure Open Source format because Microsoft controls its terms of use including the right to change the terms at any time. Moonlight can not legally be made to run on Windows or Mac. In addition, the only platform that is exempt from legal action is Novell. See this for a full description of what I mean. XAML is also not an ECMA standard like C#, Managed C++, and the CLR.

更新:问题已从是否有 WPF 的开源替代方案?因为原始问题错了,而且很烂.此问题的方向已更改方向以匹配以与 WPF 保持一致新输入.我向在更改之前回复的人道歉.

推荐答案

Qt 正在开发 QML,除了 JSON 之外,它看起来很像 XAML.它可作为针对当前版本构建的预览版提供,并在下一版本的快照中提供.

Qt is developing QML, which looks a lot like XAML except in JSON. It's available as a preview built against the current version, and is available in snapshots of the next version.

这是 http://doc 的一小段代码.qt.nokia.com/4.7-snapshot/declarative-ui-components-progressbar.html

import Qt 4.7
import "content"

Rectangle {
   id: main

    width: 600; height: 405
    color: "#edecec"

    Flickable {
       anchors.fill: parent
       contentHeight: column.height + 20

       Column {
           id: column
           x: 10; y: 10
           spacing: 10

           Repeater {
               model: 25

               ProgressBar {
                 property int r: Math.floor(Math.random() * 5000 + 1000)
                 width: main.width - 20

                 NumberAnimation on value { duration: r; from: 0; to: 100; loops: Animation.Infinite }
                 ColorAnimation on color { duration: r; from: "lightsteelblue"; to: "thistle"; loops: Animation.Infinite }
                 ColorAnimation on secondColor { duration: r; from: "steelblue"; to: "#CD96CD"; loops: Animation.Infinite }
               }
           }
       }
   }
}

这篇关于WPF/XAML 的开源替代品有哪些?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆