窗口外的 C# WPF DataGrid
我正在构建一个需要可隐藏的 DataGrid 的应用程序。我尝试过将其包装在 Expander
中,但它并不完全理想。理想情况下,我想要的是能够让 DataGrid “浮动”在主窗口之外,而不影响其他控件,并且只需一个按钮在需要时隐藏和显示它。
这有可能吗?
感谢您抽出时间。
I am building an application that requires a DataGrid
that can be hidden. I have tried wrapping it in an Expander
but it isn't exactly ideal. Ideally what I would like is the ability to have the DataGrid
"floating" outside the main window without affecting the other controls and just having a button to hide and show it when needed.
Is this at all possible?
Thanks for your time.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您可以将其放入
Popup
中并更改其 IsOpen 状态以隐藏或显示它。但请记住,弹出窗口不会随窗口移动。You could put it in a
Popup
and change its IsOpen state to hide or show it. Though keep in mind that the Popup won't move around with the window.您必须将其放在表格上才能使其浮动。新表单可以是作为非模式打开的主表单的子表单。
You will have to put it on a form to make it float. The new form can be a child of the main form opened as non-modal.