一些 AvalonDock 样式问题 (WPF)

发布于 2024-09-30 00:26:00 字数 320 浏览 3 评论 0原文

我正在尝试将 AvalonDock 实现到我的应用程序中,但我在弄清楚一些样式技术时遇到了困难。如果有人可以帮助解决以下几个问题,我将非常感激:

1)有没有办法从 DocumentPane 中删除主要的“关闭”按钮,而是将单独的按钮放在选项卡上?

2)我的应用程序中有自定义样式的按钮,这些按钮放置在 DockableContent 元素内。只要 DockableContent 停靠,按钮就会使用我的自定义模板,但如果将包含 DockableContent 的 DockablePane 拉出并使其浮动,则按钮会丢失其模板。有什么技巧可以让它保持住吗?

预先感谢您的帮助!

I'm trying to implement AvalonDock into my application, but I'm having trouble figuring out some of the styling techniques. If someone could please help with the following couple of questions, I would be very grateful:

1) Is there a way to remove the main "Close" button from a DocumentPane and instead place individual buttons on the tabs?

2) I have custom-styled buttons in my application that are placed inside DockableContent elements. As long as the DockableContent is docked, the button uses my custom template, but if a pull the DockablePane that contains the DockableContent out and have it floating, the button loses its template. Is there some trick to getting this to hold?

Thanks in advance for your help!

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

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

发布评论

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

评论(2

青萝楚歌 2024-10-07 00:26:00

关于#2,这似乎是 AvalonDock 中的一个问题。我有一个 TabControl,当其可停靠内容浮动时,它会失去其样式。对接后,样式将恢复。

解决方法是重置 StateChanged 事件的样式。

private void OnDockableContentStateChanged (object sender, RoutedEventArgs e)
{
    if (uxDockableContent.State == DockableContentState.DockableWindow)
    {
        foreach (TabItem tabItem in uxTabControl.Items)
        {
            tabItem.Style = FindResource ("TabItemStyle") as Style;
        }
    }
}

With regard to #2, that seems to be a problem in AvalonDock. I have a TabControl that loses its styling when its dockable content is floated. When docked, styling is restored.

The workaround is to reset the styling on the StateChanged event.

private void OnDockableContentStateChanged (object sender, RoutedEventArgs e)
{
    if (uxDockableContent.State == DockableContentState.DockableWindow)
    {
        foreach (TabItem tabItem in uxTabControl.Items)
        {
            tabItem.Style = FindResource ("TabItemStyle") as Style;
        }
    }
}
无法言说的痛 2024-10-07 00:26:00

我很幸运地通过下载源代码、进行更改并重新编译 DLL 来解决这个问题。

I had the best luck getting around this by just downloading the source code, making my changes, and recompiling the DLL.

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