[UWP] [XAML]创建平铺背景 [英] [UWP][XAML]Creating a Tiled Background

查看:72
本文介绍了[UWP] [XAML]创建平铺背景的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想创建一个背景(最好是画笔或ImageBrush),重复或平铺以填充Brush用于的任何区域。我认为曾经有一种方法可以做到这一点,但如果它仍然存在,我似乎无法找到它。我知道
我当然可以使用代码隐藏来做这样的事情,但这样效率非常低。 XAML有没有办法在UWP for Windows Store应用程序中执行此操作?谢谢。



Nathan Sokalski njsokalski@hotmail.com http://www.nathansokalski.com/

解决方案

< blockquote>

来自UWP的
TileControl
社区工具包执行此操作(以及更多)。它不是Brush而是ContentControl,因此它可以为任何XAML元素提供背景。


如果你想编写自己的代码隐藏,请查看
源代码


I would like to create a background (preferably as a Brush or ImageBrush) that repeats or tiles to fill whatever area the Brush is used for. I thought that there used to be a way to do this, but if it is still there I can't seem to find it. I know that I could, of course, do something like this using codebehind, but that would be very inefficient. Does XAML have any way to do this in UWP for Windows Store apps? Thanks.


Nathan Sokalski njsokalski@hotmail.com http://www.nathansokalski.com/

解决方案

The TileControl from UWP Community Toolkit does this (and more). It's not a Brush but a ContentControl, so it can serve a background for any XAML element.

If you want to write your own codebehind, check its source code.


这篇关于[UWP] [XAML]创建平铺背景的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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