从 Web 开发人员 (HTML/CSS) 到 WPF:如何开始设计我的 WPF 应用程序样式?

发布于 2024-09-15 21:16:32 字数 469 浏览 3 评论 0原文

我了解 HTML/CSS 并且想学习 WPF 样式。我该如何开始。例如,我发现填充在 WPF 应用程序中的工作方式有所不同。

在 CSS 中:

padding: 5px 10px;

在 XAML 中?

Padding="5px" 

我注意到我需要扩大元素的宽度,例如。自己扣上按钮来容纳填充物?如果是这样,我该如何计算盒模型?文本没有 line-height 对吗?因此,如果我的 font-size 为 15px,内边距为 5px,那么我的高度将为 25px?

我可以设置不同的水平和垂直填充吗?

我如何应用简单的渐变。仅使用 Visual Studio 会很难吗?

我很欣赏教程或入门建议的链接。如果有 HTML/CSS 到 WPF/XAML 的文章或教程那就更好了!

i know HTML/CSS and want to learn WPF styling. how can i get started. i see that padding, for example, works differently in WPF app.

in css:

padding: 5px 10px;

in XAML?

Padding="5px" 

i notice that i need to expand the width of the element eg. button myself to accomodate the padding? if so, how can i calculate the box model? the text has no line-height right? so if i have a font-size of 15px and padding of 5px, my height will be 25px?

and can i set different horizontal and vertical paddings?

how can i apply simple gradients. will it be very hard with just visual studio?

i appreciate links to tutorials or advice on getting started. if there is a HTML/CSS to WPF/XAML article or tutorial that will be even better!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

三寸金莲 2024-09-22 21:16:32

填充基本上是一种厚度结构,因此

<MyControl Padding="left"/>

<MyControl Padding="left,top"/>

<MyControl Padding="left,top,right,bottom" ... />

如果您仅指定左侧,则其值将复制到顶部、右侧和底部。
如果指定 left 和 top,则 left 复制到 right,从上到下(如垂直和水平填充)

对于简单渐变 VS 是可以的。

首先,尝试在代码中使用 xaml,而不是使用 Blend 等所见即所得工具。 VS或者XamlPad都不错。

Padding is basically a Thickness structure, hence

<MyControl Padding="left"/>

<MyControl Padding="left,top"/>

<MyControl Padding="left,top,right,bottom" ... />

If you specify only left one its value is copied to top, right and bottom.
If you specify left and top, left is copied to right and top to bottom ( like vertical and horizontal paddings)

For simple gradients VS is OK.

For a start, try to get around with xaml in code rather than using WYSIWYG tools like Blend. VS or XamlPad are good.

爱,才寂寞 2024-09-22 21:16:32

如果您是设计师,请使用 Expression Blend 而不是 Visual Studio。开始使用简单的样式并查看设计器后面,您将看到 XAML 代码。 XAML 比 HTML 和 CSS 强大得多。如果您想深入了解,请访问 MSDN 库<​​/a>。

Use Expression Blend instead of Visual Studio if you are a designer. Start playing with simple styles and look behind the designer and you will see the XAML code. XAML is much more powerful than HTML and CSS. And if you want to take a deeper look visit the MSDN Library.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文