Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/date/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# UWP/WinRT从多个矩形生成路径_C#_Xaml_Geometry_Winrt Xaml_Uwp - Fatal编程技术网

C# UWP/WinRT从多个矩形生成路径

C# UWP/WinRT从多个矩形生成路径,c#,xaml,geometry,winrt-xaml,uwp,C#,Xaml,Geometry,Winrt Xaml,Uwp,如何从两个或多个矩形创建自定义路径? 我正在使用xaml/UWP,填充颜色必须透明 现状; 需要状态; 目前我正在使用以下代码: GeometryGroup path = new GeometryGroup(); path.Children.Add(new RectangleGeometry() { Rect = new Rect(0, 0, 100, 100) }); path.Children.Add(new RectangleGeometry() { Rect = new Rect(3

如何从两个或多个矩形创建自定义路径? 我正在使用xaml/UWP,填充颜色必须透明

现状;

需要状态;

目前我正在使用以下代码:

GeometryGroup path = new GeometryGroup();
path.Children.Add(new RectangleGeometry() { Rect = new Rect(0, 0, 100, 100) });
path.Children.Add(new RectangleGeometry() { Rect = new Rect(30, 30, 150, 100) });
Data = path;


<Path HorizontalAlignment="Left" VerticalAlignment="Top" Margin="10"
Data="{Binding Data}"
Stroke="Blue" StrokeThickness="5" Opacity="1" />
GeometryGroup路径=新的GeometryGroup();
Add(new RectangleGeometry(){Rect=new Rect(0,0,100,100)});
Add(new RectangleGeometry(){Rect=new Rect(30,30,150,100)});
数据=路径;

我从不在codebehind中使用xaml,但一个简单的方法是使用Blend,在设计器中选择两者,右键单击,然后选择Path->UniteThats这不是我的解决方案。我需要一个绑定和动态计算矩形的解决方案。在WPF中,您可以使用组合几何。然而,据我所知,在UWP中没有这样的东西,所以你必须自己计算得到的几何体。你知道计算的例子吗?也许用其他语言?因为我没有在谷歌上找到任何东西:(