- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我想删除它们,因为这给我带来了很多问题。如果有办法解决它,我会很乐意尝试。
使用它的前几分钟我得到了 3 个不同的异常(exception),我不知道如何删除那些该死的选项。
固定和取消固定和固定会引发 InvalidOperationException,因为由于对象的当前状态,操作无效。
有时固定和取消固定会打开一个对话框并要求我提供一个文件,我不希望这种情况发生,但它正在发生并引发异常。
我不小心点击了关闭按钮,无法恢复窗口。
这真的很令人沮丧。我相信其他 avalondock 用户也遇到过这个问题。
因为我不想浪费太多时间,所以我要在这里问。
您是如何解决此异常或删除这些按钮的?谢谢。
最佳答案
我和你的问题完全一样。不愿意从实际用户界面中删除图标,我只是用事件处理程序禁用它们
这是我的工作方式:
要删除这些隐藏和自动隐藏命令:
我添加了以下处理程序:
CommandManager.AddPreviewExecutedHandler(this, new ExecutedRoutedEventHandler(this.ContentClosing))
ContentClosing
好像:
/// <summary>
/// Handler called when user clicked on one of the three buttons in a DockablePane
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void ContentClosing(object sender, ExecutedRoutedEventArgs e)
{
if (e.Command == ApplicationCommands.Close || e.Command == DockablePaneCommands.Close)
{
e.Handled = true;
DockManager source = sender as DockManager;
if (source.ActiveContent != null)
{
source.ActiveContent.Close();
}
}
else if (e.Command == DockablePaneCommands.Hide || e.Command == DockablePaneCommands.ToggleAutoHide)
{
e.Handled = true;
AvalonDock
将关闭另一个内容,因为它具有焦点(单击十字不会将焦点放在您的内容上,因此它将关闭当前聚焦的内容......)
AvalonDock
将移除最后剩余的面板。此外,如果您关闭
DockableContent
里面有很多标签,
AvalonDock
将关闭所有选项卡,所以我必须实现一些功能来关闭当前选项卡(这更有意义,恕我直言)我必须向添加的每个内容添加一个鼠标按下处理程序以捕获此事件。使用以下技巧,我可以采取一种解决方法来避免此错误:
/// <summary>
/// Handler called when a DockableContent state changed.
/// We need it to define a PreviewMouseDownHandler for each DockablePane
/// possibly created (which are usually created upon docking a floating window
/// to a new position) in order to handle single DockableContent closing
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
void NewContent_StateChanged(object sender, RoutedEventArgs e)
{
DockableContent source = sender as DockableContent;
if (source.State == DockableContentState.Docked && source.Parent is DockablePane)
{
DockablePane parent = source.Parent as DockablePane;
parent.PreviewMouseDown -= mouseHandler;
parent.PreviewMouseDown += mouseHandler;
}
}
/// <summary>
/// Handler called on mouse down on a DockablePane.
/// It is designed to detect where did the user click, and
/// if he clicked on Close, only the current DockableContent will be closed
/// (unlike the native behavior which requires us to close the entire DockablePane
/// upon clicking on Close...)
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
void DockablePaneMouseDown(object sender, MouseButtonEventArgs e)
{
DockablePane source = sender as DockablePane;
if (e.OriginalSource is AvalonDock.ImageEx)
{
//User clicked on one of the three icons on the top-right corner of the DockablePane
if ((e.OriginalSource as AvalonDock.ImageEx).Source.ToString().Contains("PinClose"))
{
RemoveFromUI(source.SelectedItem as DockableContent);
e.Handled = true;
}
}
}
/// <summary>
/// Removes a DockableContent from the currently displayed UI
/// (called when the original DockableItemsSource changed)
/// </summary>
/// <param name="content">The content to be removed</param>
private void RemoveFromUI(DockableContent content)
{
if (content == null)
{
return;
}
DockablePane parent = content.Parent as DockablePane;
if (this.ActiveContent == parent.SelectedItem)
{
this.ActiveContent = null;
}
(parent.SelectedItem as DockableContent).Close();
//// If the current DockablePane is left empty, we ensure to close it
if (parent.Items.Count == 0)
{
//This case is needed if we are trying to remove the last DockablePane from a DockingManager
//Native behavior will NOT set the Content property if you remove the last DockablePane:
//it will therefore consider this CLOSED DockablePane as the current ActiveContent,
//and will try to add new contents in this closed pane, which seems rather disturbing.
//Here we explicitly set the Content property to null if we are removing the last element,
//so next time user adds a tab, it will be added as the new Content!
if (parent == this.Content)
{
this.Content = null;
}
parent.Close();
parent.Visibility = Visibility.Hidden;
}
}
AvalonDock
远未准备好生产环境,我不得不调整这些东西以使其工作。
关于wpf - 移除 AvalonDock 坞站并关闭按钮,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11987893/
前不久,哔哩哔哩(一般常称为 B 站)发布了一篇文章《2021.07.13 我们是这样崩的》,详细回顾了他们在 2021.07.13 晚上全站崩溃约 3 小时的至暗时刻,以及万分紧张的故障定位与恢复过
想象一下这种情况,周围有一些智能手机和计算机,它们的 WiFi 适配器(无线适配器)打开,但没有必要连接到网络。 有没有办法通过 Linux 机器查看 MAC 地址? 任何见解表示赞赏。 最佳答案 断
我无法创建新的 Window Station 来运行我的应用程序 int _tmain(int argc, TCHAR* argv[], TCHAR* envp[]) { wprintf(L"
在 Conda 环境中安装包后,我想对该包中的代码进行一些更改。 在哪里可以找到包含已安装包的 site-packages 目录? 我有 Anaconda Python 2.7 base 发行版,但找
今天去改了matplotlib的配置。搜索 matplotlibrc 发现我有两个: 查看site-packages 文件夹,我发现很多包的名称中都有波浪号: ~klearn 是 sklearn ,但
我是一名优秀的程序员,十分优秀!