从 Web 开发人员 (HTML/CSS) 到 WPF:如何开始设计我的 WPF 应用程序样式?
我了解 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
填充基本上是一种厚度结构,因此
如果您仅指定左侧,则其值将复制到顶部、右侧和底部。
如果指定 left 和 top,则 left 复制到 right,从上到下(如垂直和水平填充)
对于简单渐变 VS 是可以的。
首先,尝试在代码中使用 xaml,而不是使用 Blend 等所见即所得工具。 VS或者XamlPad都不错。
Padding is basically a Thickness structure, hence
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.
如果您是设计师,请使用 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.