C# RibbonComboBox选定的库项在鼠标左键时恢复为旧值
我已经将WPF功能区替换为最新的库,组合框选择改变了datagrid的重新加载。我对彩带盒有问题 如果我带着鼠标离开或离开所选项目,所选项目将恢复为旧项目。如果在datagrid重新加载完成之前将光标保持在选定项上,则ribboncombobox将接受新值 我是否错过了一些特殊的ribboncombobox属性以仅通过单击接受更改,或者这是combobox组件中的错误? 唯一可能的解决方法是在线程中启动datagrid重载函数,让ribbon组合框完成其进程 此处的示例代码:C# RibbonComboBox选定的库项在鼠标左键时恢复为旧值,c#,wpf,ribbon,C#,Wpf,Ribbon,我已经将WPF功能区替换为最新的库,组合框选择改变了datagrid的重新加载。我对彩带盒有问题 如果我带着鼠标离开或离开所选项目,所选项目将恢复为旧项目。如果在datagrid重新加载完成之前将光标保持在选定项上,则ribboncombobox将接受新值 我是否错过了一些特殊的ribboncombobox属性以仅通过单击接受更改,或者这是combobox组件中的错误? 唯一可能的解决方法是在线程中启动datagrid重载函数,让ribbon组合框完成其进程 此处的示例代码: <r:Rib
<r:RibbonComboBox>
<r:RibbonGallery SelectedValuePath="Content" SelectionChanged="pgSize_SelectionChanged">
<r:RibbonGalleryCategory>
<r:RibbonGalleryItem Tag="20" Content="Size (20)" Foreground="Green" />
<r:RibbonGalleryItem Tag="30" Content="Size (30)" Foreground="Green" IsSelected="True"/>
<r:RibbonGalleryItem Tag="50" Content="Size (50)" Foreground="Orange" />
<r:RibbonGalleryItem Tag="100" Content="Size (100)" Foreground="Red" />
</r:RibbonGalleryCategory>
</r:RibbonGallery>
</r:RibbonComboBox>
这是功能区控件中的一个错误。请参阅。以下提供了一个基于中给出的解决方案的有效解决方案(.Net 4.0)
我发现您只需要在SelectionChanged
事件中使用鼠标。捕获(null)
:
隐藏以下代码:
void RibbonGallery_SelectionChanged(
object sender,
RoutedPropertyChangedEventArgs<object> e)
{
Mouse.Capture(null);
}
void RibbonGallery\u选择已更改(
对象发送器,
RoutedPropertyChangedEventArgs(e)
{
鼠标捕捉(空);
}
或者,作为派生类:
/// <summary>
/// Fixes a known issue with the <see cref="RibbonGallery"/>.
/// </summary>
/// <remarks>
/// See <a href="https://connect.microsoft.com/VisualStudio/feedback/details/666352/">Allow users to move mouse after selecting an item in WPF RibbonComboBox</a>.
/// </remarks>
public class RibbonGalleryEx : RibbonGallery
{
public RibbonGalleryEx()
{
this.SelectionChanged += (sender, e) => Mouse.Capture(null);
}
}
//
///修复了的一个已知问题。
///
///
///看。
///
公共类RibbonGalleryEx:RibbonGallery
{
公共RibbonGalleryEx()
{
this.SelectionChanged+=(发送方,e)=>Mouse.Capture(null);
}
}