RibbonControlsLibrary 中的样式功能区

发布于 2024-10-19 20:42:17 字数 592 浏览 3 评论 0原文

丝带不错啊我想让它变得更好......(恕我直言)

使用功能区(来自.NET 3.5 sp1 上的 RibbonControlsLibrary),可以更改一些背景和前景。但我想要重新设计的是位于 RibbonTabGroup“背景”中的白色“蒙版”(带有 alpha 的线性渐变画笔)。我和史努比一起看过。我在风格中找到了它。

<LinearGradientBrush x:Key="[49] Í" StartPoint="0.5,0.0" EndPoint="0.5,1.0">
    <GradientStop Color="#EEFFFFFF" Offset="0.0" />
    <GradientStop Color="#BBFFFFFF" Offset="0.1" />
    <GradientStop Color="#05FFFFFF" Offset="0.5" />
    <GradientStop Color="#20FFFFFF" Offset="1.0" />
</LinearGradientBrush>

但我仍然不知道如何覆盖它。我也不知道它设置在哪里... 干杯,帕特里克

Ribbon is nice. I want to make it nicer... (IMHO)

With the Ribbon (from RibbonControlsLibrary on .NET 3.5 sp1), it is ok to change some backgrounds and foregrounds. But the thing I want to re-style is the white "mask" (linear gradient brush with alpha) that seats in the "background" of the RibbonTabGroup. I saw it with Snoop. I found it in the style.

<LinearGradientBrush x:Key="[49] Í" StartPoint="0.5,0.0" EndPoint="0.5,1.0">
    <GradientStop Color="#EEFFFFFF" Offset="0.0" />
    <GradientStop Color="#BBFFFFFF" Offset="0.1" />
    <GradientStop Color="#05FFFFFF" Offset="0.5" />
    <GradientStop Color="#20FFFFFF" Offset="1.0" />
</LinearGradientBrush>

But still I have no idea how to override it. I don't know either where it is set...
Cheers, Patrick

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

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

发布评论

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

评论(1

古镇旧梦 2024-10-26 20:42:17

我得到了它!

在以下帖子的帮助下 将 UserControl 序列化为 xaml,但不序列化它的孩子吗? [非常感谢你威尔]。我可以提取“默认”样式。这样我就得到了完整的风格。我之前所做的,使用 .NET Reflector 打开 RibbonControlsLibrary 并使用 BAML Viewer 读取 XAML。就我而言并不理想。

以防万一有人有同样的愿望,获取组件的默认样式(当它未发布@MSDN时):

  System.Windows.Style style = Application.Current.FindResource(typeof(Microsoft.Windows.Controls.Ribbon.Ribbon)) as System.Windows.Style;

  var sb = new System.Text.StringBuilder();
  var writer = System.Xml.XmlWriter.Create(sb, new System.Xml.XmlWriterSettings
  {
    Indent = true,
    ConformanceLevel = System.Xml.ConformanceLevel.Fragment,
    OmitXmlDeclaration = true
  });
  var mgr = new System.Windows.Markup.XamlDesignerSerializationManager(writer);
  mgr.XamlWriterMode = System.Windows.Markup.XamlWriterMode.Expression;
  System.Windows.Markup.XamlWriter.Save(style, mgr);
  string styleString = sb.ToString();

干杯,帕特里克

I got it!

With help of the following post Serialize a UserControl to xaml, but not its children? [Many thanks to you Will]. I could extract the "default" style. So I obtain the complete style. What I did before, open RibbonControlsLibrary with .NET Reflector and read the XAML with BAML Viewer. Not ideal in my case.

Just in case someone has the same wish, obtaining the default style of component (when it isn't published @MSDN):

  System.Windows.Style style = Application.Current.FindResource(typeof(Microsoft.Windows.Controls.Ribbon.Ribbon)) as System.Windows.Style;

  var sb = new System.Text.StringBuilder();
  var writer = System.Xml.XmlWriter.Create(sb, new System.Xml.XmlWriterSettings
  {
    Indent = true,
    ConformanceLevel = System.Xml.ConformanceLevel.Fragment,
    OmitXmlDeclaration = true
  });
  var mgr = new System.Windows.Markup.XamlDesignerSerializationManager(writer);
  mgr.XamlWriterMode = System.Windows.Markup.XamlWriterMode.Expression;
  System.Windows.Markup.XamlWriter.Save(style, mgr);
  string styleString = sb.ToString();

Cheers, Patrick

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