问题标签 [uniformgrid]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
1 回答
2499 浏览

c# - 单击一个充满网格的 Uniformgrid,获取网格的名称我单击

我是 WPF 新手,我使用此代码用网格填充统一网格,

然后,当我单击名为 ChessBoard 的制服网格时,我试图找出某个网格的名称。

不透明度线是测试以确保我在正确的网格上,它可以工作并改变我点击的网格的不透明度。

我需要帮助的是找到元素的 Name 属性。

0 投票
1 回答
1035 浏览

c# - How to create UniformGrid in XAML with autoscrolls after exceding rows limit by elements

I would like to create UniformGrid which will contain WindowsFormsHosts(inside them are WinForms). 4 Hosts in every row(4 cols) and after exceding its' visible capacity new elements will be added underneath and user will be able to scroll the UniformGrid. I do not know even where to start beside defining UniFormGrid and its' column number.

The behaviour I would like to get is just like in Windows' explorer if there are too many icons in the view you can scroll down.

I used UniformGrid because I needed equivalent of GridLayout() in Java. I want every added element to be the same size. I add elements from .cs.

0 投票
1 回答
723 浏览

java - 二维圆之间的统一网格碰撞检测

我正在开发一个 2d 街机游戏,其中有 5 种不同大小的圆圈:船、导弹和 3 种怪物。

这是它的样子:

在此处输入图像描述

目前我正在使用蛮力碰撞检测,在不考虑碰撞概率的情况下检查每个导弹与每个怪物。可悲的是,这使得这个过程真的很慢。

这是我的 Grid 类,但它不完整。非常感谢您的帮助。

但这就是我完全不知所措的地方。我什至不确定我提供的源代码是否正确。请让我知道如何使基于网格的碰撞工作。我基本上已经阅读了我可以掌握的所有教程,但效果不佳。谢谢。

0 投票
1 回答
4690 浏览

wpf - 使用 UniformGrid 的列表框 - 项目未居中

我有一个使用 UniformGrid 作为 ItemsPanelTemplate 的列表框。这是一张照片列表。我希望照片在网格的每个单元格的中心水平居中,但似乎无论我做什么,图像都与每个单元格的左侧对齐。这是我当前的 XAML:

如您所见,我将 DataTemplate 中的 Image 控件设置为 Horizo​​ntalAlignment="Center",我认为可以这样做,但它不起作用。

我究竟做错了什么?

0 投票
1 回答
124 浏览

c# - Tile view with fixed column number, and with resizing adequately to main window size

I am trying to create a tile view, the code below creates one, but when the window is resized, the space, between tile grows. And instead i would like to have the tiles grow with the window, i had look at quite few places, but i couldnt find a solution to it, is anybody able to help

user control

Main window

I'd like the tiles to grow as the window grow.

0 投票
1 回答
343 浏览

c# - 在 WPF 中的 UniformGrid 中保存图像

我需要保存图像,我在UniformGrid. 有没有可能?我正在使用 UniformGrid,因为如果我正在扩展 Window,Image 会适应 UniformGrid 大小(负责)。请问您有什么想法吗?

0 投票
2 回答
2786 浏览

c# - 具有多个项目的统一网格控件 C# WPF

我需要一个像下面这样的窗口;

在此处输入图像描述

我试图实现这一目标,但无法获得 100% 的结果。我哪里做错了?

结果窗口;

在此处输入图像描述

0 投票
1 回答
483 浏览

c# - 将 CustomClass 的 ObservableCollection 绑定到 Grid

我必须在单击按钮时在网格中显示 Observable Collection 的内容。在按钮单击(我知道可以使用命令绑定但为简单起见单击处理程序)集合应该填充并显示模型类的名称属性。

视图模型:

模型:

看法:

任何的想法?为什么集合不显示在网格中

0 投票
1 回答
1618 浏览

.net - 如何“获取” UniformGrid 中组件的行和列?

我从msdn 文章中看到 UniformGrid 类不支持“设置”列或行的附加属性。在我当前的编程问题中,我已经向 UniformGrid 添加了组件,但是在我添加到 UniformGrid 的组件的单击处理程序中,我希望组件知道它们在哪一行和哪一列中结束。

即使无法“设置”这些数据,有没有办法“获取”它?

0 投票
1 回答
129 浏览

c# - 如何在 UniformGrid 运行时添加按钮名称?

在运行时获取Button在 UniformGrid 上添加的名称。

我的代码是:

Button我的要求是在其他函数中获取名称:

这是我的 XAML: