English 中文(简体)
KeyTip 不在微软丝带中工作
原标题:KeyTip not working in Microsoft Ribbon
  • 时间:2012-05-24 15:10:10
  •  标签:
  • c#
  • wpf
  • ribbon

KeyTip没有使用丝带控制图书馆(3.5.41019.1)。 我创建了一个简单的丝带窗口:

  1. Add a couple of tabs
  2. Add some controls like a button
  3. Set properties such as labels and headers
  4. Set the KeyTip properties on the tabs

我用 desgin 模式( VS2010) 测试了 KeyTip, 一切都如预期的那样有效。 但是,当我将项目建成一个窗口应用程序时, 就会发生以下情况:

  • ALT+KeyTip only shows the keytips, no focus is changing. The expected behaviour would be a change of tab...

我试图创建一个干净的 WpfRibbon 工程, 并且做了同样的事情, 并且出于某种原因它也起作用了。 没有一项工程是“ em> Forms < / em > 和 < em> WPF < / em” 的混合体, 并在 WPF 窗口前显示一个窗体。 这会不会是问题? 我大炮明白这有什么问题吗?

Source code:

        <ribbon:RibbonTab x:Name="HomeTab" 
                          Header="Home" KeyTip="H">
            <ribbon:RibbonGroup x:Name="Group1" 
                                Header="Group1">
                <ribbon:RibbonButton Label="Hej" KeyTip="T" />                    
            </ribbon:RibbonGroup>

        </ribbon:RibbonTab>

        <ribbon:RibbonTab Header="Tab1">
            <ribbon:RibbonGroup Header="Min grupp">
                <ribbon:RibbonButton Label="Test" />
                <ribbon:RibbonSplitButton Label="Testen">
                    <ribbon:RibbonMenuItem Header="Jaha" />
                </ribbon:RibbonSplitButton>
            </ribbon:RibbonGroup>
        </ribbon:RibbonTab>

        <ribbon:RibbonTab Header="Tab2" KeyTip="2" />
        <ribbon:RibbonTab Header="Tab3" KeyTip="3" />
</ribbon:Ribbon>
问题回答

在显示 WPF 窗口前, 我添加了以下代码行, 解决了问题:

System.Windows.Forms.Integration.ElementHost.EnableModelessKeyboardInterop(this);

如果您将 WinForms 和 WPF 窗口混合在同一项目中, 至少在 WinForms 窗口前显示 WinForms 和 WPF 窗口时, 这一点是必要的 。

在ribbon cotrol 中添加属性: 键盘导航。 ControlTab导航

 <ribbon:Ribbon DockPanel.Dock="Top" SelectedIndex="1" KeyboardNavigation.ControlTabNavigation="Contained">

它为我工作。





相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

NSArray s, Primitive types and Boxing Oh My!

I m pretty new to the Objective-C world and I have a long history with .net/C# so naturally I m inclined to use my C# wits. Now here s the question: I feel really inclined to create some type of ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

How to Use Ghostscript DLL to convert PDF to PDF/A

How to user GhostScript DLL to convert PDF to PDF/A. I know I kind of have to call the exported function of gsdll32.dll whose name is gsapi_init_with_args, but how do i pass the right arguments? BTW, ...

Linqy no matchy

Maybe it s something I m doing wrong. I m just learning Linq because I m bored. And so far so good. I made a little program and it basically just outputs all matches (foreach) into a label control. ...

热门标签