在 WPF 中创建网格/WrapPanel 或其他 UIElement 的缩略图

发布于 2024-08-08 14:15:06 字数 219 浏览 1 评论 0原文

我有一个带有一些图像Grid

我想制作另一个 Grid ,它将是这个 Grid 的副本,“只是更小”。我希望添加到第一个 Grid 的每个 Image 也会添加到另一个 Grid 中。

如果有人可以帮助我。

I have a Grid with some Images.

I want to make another Grid that will be copy of this Grid, 'only smaller'. I want every Image I will add to the first Grid will add also to the other Grid.

If someone can help me.

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

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

发布评论

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

评论(2

清秋悲枫 2024-08-15 14:15:06

如果您使用 MVVM,您就有一个驱动第一个网格内容的绑定。将第二个网格重新绑定到相同的数据成员,即使在对该集合执行编辑之后,它也会更新以显示相同的内容。

If you use MVVM you have a binding that drives the first grid's contents. Rebind the second grid to the same data member and it will update to show the same contents even after edits were performed on that collection.

夜司空 2024-08-15 14:15:06

使用视觉画笔

<Page xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<UniformGrid Rows="1">
    <StackPanel Name="Original" Width="100" Height="100">
        <TextBlock Text="Pretend I'm a list of images"/>
        <TextBlock Text="Pretend I'm a list of images"/>
        <TextBlock Text="Pretend I'm a list of images"/>
        <TextBlock Text="Pretend I'm a list of images"/>
        <TextBlock Text="Pretend I'm a list of images"/>
        <TextBlock Text="Pretend I'm a list of images"/>
        <TextBlock Text="Pretend I'm a list of images"/>
        <TextBlock Text="Pretend I'm a list of images"/>
        <TextBlock Text="Pretend I'm a list of images"/>
        <TextBlock Text="Pretend I'm a list of images"/>
    </StackPanel>
    <Rectangle Name="Thumbnail" Width="50" Height="50">
        <Rectangle.Fill>
            <VisualBrush Visual="{Binding ElementName=Original}"/>
        </Rectangle.Fill>
    </Rectangle>
</UniformGrid>
</Page>

Use VisualBrush

<Page xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<UniformGrid Rows="1">
    <StackPanel Name="Original" Width="100" Height="100">
        <TextBlock Text="Pretend I'm a list of images"/>
        <TextBlock Text="Pretend I'm a list of images"/>
        <TextBlock Text="Pretend I'm a list of images"/>
        <TextBlock Text="Pretend I'm a list of images"/>
        <TextBlock Text="Pretend I'm a list of images"/>
        <TextBlock Text="Pretend I'm a list of images"/>
        <TextBlock Text="Pretend I'm a list of images"/>
        <TextBlock Text="Pretend I'm a list of images"/>
        <TextBlock Text="Pretend I'm a list of images"/>
        <TextBlock Text="Pretend I'm a list of images"/>
    </StackPanel>
    <Rectangle Name="Thumbnail" Width="50" Height="50">
        <Rectangle.Fill>
            <VisualBrush Visual="{Binding ElementName=Original}"/>
        </Rectangle.Fill>
    </Rectangle>
</UniformGrid>
</Page>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文