WPF Gridview Zindex

发布于 2024-07-14 06:59:46 字数 464 浏览 10 评论 0原文

我有一个日期选择器控件,用于在 gridview 控件中设置日期字段,我的日期选择器显示一个日期和一个按钮来显示可用于选择日期的日历。 这本身就很好用,但是当我将其添加到网格视图时,日历会弹出,列和行会覆盖日历的部分内容。 设置日历的 ZIndex 没有帮助,因为其他行位于不同的面板上? 我该如何解决这个问题? 我尝试提高 VisualParent 的 ZIndex 但没有成功。

更新,gridview 非常标准,4 列,其中一列是日期列,该列的数据模板创建一个日期选择器,最初看起来像一个文本框和一个按钮,按钮放置在画布面板上,单击日历时被添加到画布上。 画布是唯一允许其子项超出其自身边界的面板,因此按钮大小为 10 x 10 左右,日历大小为 200 x 200。当日历弹出时,它通常只会覆盖相邻字段,但当放置在gridview 日期选择器“之后”的 gridview 的每个单元格覆盖日历。 我想我需要提高单元格的 zindex,但我找不到方法来做到这一点?

I have a datepicker control that I am using to set a date field in a gridview control, my datepicker shows a date and a button to display a calendar you can use to pick a date. This works great on its own but when I add this to a gridview the calendar pops up and the columns and rows cover up parts of the calendar. Setting the ZIndex for the calendar doesn't help because the other rows are on different panels? How can I get around this? I tried raising the ZIndex of the VisualParent but no luck.

Update, the gridview is very standard, 4 columns one of which is a date column, the datatemplate for that column creates a datepicker which initially looks like a text box and a button, the button is placed on a canvas panel and when clicked a calendar is added to the canvas. The canvas is the only panel that allows its children to stretch over its own boundaries so the button is 10 x 10 or so and the calendar is 200 x 200. When the calendar pops up it normally just covers up adjacent fields but when placed on a gridview each cell of the gridview that is "after" the datepicker covers up the calendar. I'm supposing I need to raise the zindex of my cell but I can't find a way to do this?

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

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

发布评论

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

评论(2

渔村楼浪 2024-07-21 06:59:47

哇,这应该使用弹出窗口或扩展器来完成。

Wow, this should be done using a popup or an expander.

自找没趣 2024-07-21 06:59:46

您能提供有关 gridview 和 datepicker 的更多信息吗? 特别是它们是您的自定义控件还是属于任何开源或商业库或单独的?

您还提到 DataTemplate 有 Canvas 作为面板。 尽管 Canvas 可以包含大型元素,但它不一定显示其所有子元素。 不过,这可能与您的问题有关,也可能无关。

PS 抱歉,我不得不将此作为答案发布。 我的名誉不允许我发表评论吗?

Could you provide more info about gridview and datepicker? Especially are they your custom controls or do they belong to any open source or commercial libraries or separate?

You also mentioned that DataTemplate has Canvas as a panel. Even though a Canvas can contain large elements, it does not necessarily show all of its children. This may or may not relate to your problem, though.

P.S. Sorry I had to post this as an answer. My reputation does not allow me to comment?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文