我正在尝试将文本放在RibbonApplicationMenu的顶层(尝试获取类似于Word或Outlook的"文件"一词).似乎Microsoft.Windows.Controls.Ribbon.RibbonApplicationMenu
http://msdn.microsoft.com/en-us/library/microsoft.windows.controls.ribbon.ribbonapplicationmenu.aspx支持SmallImageSource但没有文本属性.设置该Label
属性不适用于此问题.
xmlns:ribbon="clr-namespace:Microsoft.Windows.Controls.Ribbon;assembly=RibbonControlsLibrary"
<ribbon:RibbonApplicationMenu Label="File"> <!--doesn't set the label -->
</ribbon:RibbonApplicationMenu>
Run Code Online (Sandbox Code Playgroud)
目标是在下面的圆圈区域中显示"文件"一词.
如果我有绑定的集合,如何添加快速访问项容器默认为RibbonLibrary.它的抛出操作在ItemSource正在使用时无效,而我是从UI添加快速访问工具项.
<r:Ribbon Name="ribbon">
<r:Ribbon.QuickAccessToolBar>
<r:RibbonQuickAccessToolBar ItemsSource ="{Binding QuickMenuItems, Mode=OneWay}">
<r:RibbonQuickAccessToolBar.ItemTemplate>
<DataTemplate>
<StackPanel>
<r:RibbonButton QuickAccessToolBarId="{Binding RibbonId}" Label="{Binding Label}" SmallImageSource="{Binding ImageUri}" Command="{Binding Command}"/>
</StackPanel>
</DataTemplate>
</r:RibbonQuickAccessToolBar.ItemTemplate>
</r:RibbonQuickAccessToolBar>
</r:Ribbon.QuickAccessToolBar>
<r:RibbonTab Header="Home">
<r:RibbonGroup x:Name="Clipboard" ItemsSource ="{Binding MenuItems, Mode=OneWay}" >
<r:RibbonGroup.ItemTemplate>
<DataTemplate>
<StackPanel>
<r:RibbonButton QuickAccessToolBarId="{Binding RibbonId}" Label="{Binding Label}" SmallImageSource="{Binding ImageUri}" Command="{Binding Command}"/>
</StackPanel>
</DataTemplate>
</r:RibbonGroup.ItemTemplate>
</r:RibbonGroup>
</r:RibbonTab>
</r:Ribbon>
ObservableCollection<RibbonItem> _MenuItems;
ObservableCollection<RibbonItem> _QuickMenuItems;
public ObservableCollection<RibbonItem> MenuItems
{
get { return _MenuItems; }
}
public ObservableCollection<RibbonItem> QuickMenuItems
{
get { return _QuickMenuItems; } …
Run Code Online (Sandbox Code Playgroud) 我正在使用WPF工具包中的RibbonControl.它有Office Blue,Black和Silver主题.但主题不适用于窗口中的控件.那有什么解决方案吗?
我正在接受这样的主题
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/RibbonControlsLibrary;component/Themes/Office2007Black.xaml"/>
</ResourceDictionary.MergedDictionaries>
Run Code Online (Sandbox Code Playgroud)
但是控件就像按钮一样,文本框也没有变化.
我正在使用"Microsoft Ribbon for WPF"并创建多个RibbonTab.我无法找到一种方法来查看/聚焦设计器中的不同选项卡,默认情况下显示"主页"选项卡.要查看我对"主页"选项卡以外的选项卡进行的设计/ xaml更改,我必须每次调试项目并单击选项卡,这不是很方便.或者我可以命令我想忽略的选项卡xaml.那里的任何人都有解决方案吗?
wpf ribbon ribboncontrolslibrary system.windows.controls.ribbon
在我们编写的新WPF应用程序中,我们将使用DevExpress控件套件,并将有一个功能区.
您建议使用哪个功能区库?
目前,我看到的选项是:
您对使用哪个功能区库有任何建议吗?
我的问题基本上就是这个问题.我认为这将有助于提供一些更容易重现问题的信息和代码.
使用RibbonControlsLibrary中的Microsoft.Windows.Controls.Ribbon.RibbonComboBox 感觉就像走过一个充满了bug的大沼泽,而不是你知道如何绕过它做的事情.
Anywho.我遇到的最大问题是数据绑定我的SelectedItem.
以下是我的开始(在我发现RibbonGallery之后?).在ComboBox的子元素上使用ItemsSource和SelectedItem,甚至在同一级别上已经给了我heebie-jeebies,但这似乎是正确的.
在示例应用程序中,我在ViewModel的构造函数中设置SelectedItem.但是,在运行应用程序时,不会显示SelectedItem.甚至VS设计师也正确地展示了"第二选择"!
正在运行应用 VS设计师:
调试SelectedItem setter时,您会注意到多次传递.在第一次将它设置为ctor中的"第二个选项"(1,参见下面的调试日志)后,它将重置为null(2)(通过外部代码,我在控件本身中计算).在UI中打开下拉列表时,它将再次设置为null(3),然后在选择值时,将此值设置为两倍(4,5).我选择了"第二选项",然后用"第一选项"(6-9)重复该过程.这产生了以下日志(忽略了功能区控件中的一千零一个绑定异常...):
显而易见的大问题是(2),这是重置我的初始选择.看起来当第一次显示控件时,它会被重置.一个非常丑陋的解决方法是通过计时器设置值.在用户控件的Loaded事件中设置它在这个示例应用程序中对我有用,但在我较重的现实应用程序中,它没有.无论如何,所有这些都是错误的.有谁知道更好的解决方案?
XAML:
<UserControl x:Class="WpfApplication1.RibbonComboBoxDemo"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:r="http://schemas.microsoft.com/winfx/2006/xaml/presentation/ribbon"
xmlns:local="clr-namespace:WpfApplication1"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="300">
<UserControl.DataContext>
<local:ViewModel />
</UserControl.DataContext>
<Grid>
<r:Ribbon >
<r:RibbonTab Header="First Tab">
<r:RibbonGroup Header="Group">
<r:RibbonComboBox >
<r:RibbonGallery SelectedItem="{Binding SelectedItem, Mode=TwoWay}">
<r:RibbonGalleryCategory ItemsSource="{Binding Controls}" DisplayMemberPath="Caption" />
</r:RibbonGallery>
</r:RibbonComboBox>
</r:RibbonGroup>
</r:RibbonTab>
<r:RibbonTab Header="Second Tab" />
</r:Ribbon>
</Grid>
</UserControl>
Run Code Online (Sandbox Code Playgroud)
视图模型:
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Diagnostics;
namespace WpfApplication1
{
public class ViewModel …
Run Code Online (Sandbox Code Playgroud) 我有一个RibbonComboBox
用于设置字体大小.它有一个RibbonGallery
列出各种字体大小,显示在适当的FontSize
:
<r:RibbonComboBox DataContext="{x:Static vm:RibbonDataModel.FontSizeComboBoxData}"
SelectionBoxWidth="30">
<r:RibbonGallery MaxColumnCount="1"
Command="{Binding Command}"
CommandParameter="{Binding SelectedItem}">
<r:RibbonGallery.GalleryItemTemplate>
<DataTemplate>
<Grid>
<TextBlock Text="{Binding}"
FontSize="{Binding}" />
</Grid>
</DataTemplate>
</r:RibbonGallery.GalleryItemTemplate>
</r:RibbonGallery>
</r:RibbonComboBox>
Run Code Online (Sandbox Code Playgroud)
编辑这是我的ViewModel:
public static RibbonDataModel
{
public static GalleryData<object> FontSizeComboBoxData
{
get
{
lock (LockObject)
{
const string key = "Font Size";
if (!DataCollection.ContainsKey(key))
{
var value = new GalleryData<object>
{
Command = HtmlDocumentCommands.ChangeFontSize,
Label = "Change Font Size",
ToolTipDescription = "Set the font to a specific size.",
ToolTipTitle = "Change …
Run Code Online (Sandbox Code Playgroud) wpf ribbon ribbon-control windows-ribbon-framework ribboncontrolslibrary
我有一个关于WPF和RibbonControlsLibrary的问题.我试图找到这个错误的来源,但我似乎无法找到它.
我正在使用Microsoft 的WPF RibbonControlsLibrary.使用RibbonToggleButton时,即使在我的XAML代码中没有任何绑定,我也会收到以下错误.
<r:RibbonWindow x:Class="WpfApplication.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="300" Width="300"
xmlns:r="clr-namespace:Microsoft.Windows.Controls.Ribbon;assembly=RibbonControlsLibrary">
<r:Ribbon>
<r:RibbonTab Header="Admin" >
<r:RibbonMenuButton/>
</r:RibbonTab>
</r:Ribbon>
</r:RibbonWindow>
Run Code Online (Sandbox Code Playgroud)
System.Windows.Data错误:39:BindingExpression路径错误:'object'''找不到'IsChecked'属性''RibbonMenuButton'(Name ='')'.BindingExpression:路径=器isChecked; DataItem ='RibbonMenuButton'(Name =''); target元素是'RibbonToggleButton'(Name ='PART_ToggleButton'); target属性是'NoTarget'(类型'对象')
我对错误的最后一部分感到有点困惑:target element is RibbonToggleButton (Name='PART_ToggleButton'); target property is 'NoTarget' (type 'Object').
我的XAML代码中根本没有RibbonToggleButton?
其他人是否看到这样的行为,并能够指出我正确的方向摆脱这个错误输出?
我看到大多数WPF Ribbon示例都使用了一些代码
xmlns:r="clr-namespace:Microsoft.Windows.Controls.Ribbon;assembly=RibbonControlsLibrary"
Run Code Online (Sandbox Code Playgroud)
我收到此错误..."找不到类型'r:RibbonCommand'.确认您没有错过程序集引用,并且已经构建了所有引用的程序集."
使用VS 2010,.NET 4.0.
我试图找出如何在功能区中添加按钮并在单击时执行代码/命令.
谢谢.
我正在使用Microsoft的Ribbons Control Libary for WPF在WPF应用程序中私有Ribbon。
我们在XAML部分中以以下方式使用Splitbuttons:
<r:RibbonSplitButton Label="SplitButtonLabel" LargeImageSource="..." Command="{Binding SplitButtonCommand}">
<r:RibbonSplitMenuItem Header="Item 1" ImageSource="..." Command="{Binding Command1}"/>
<r:RibbonSplitMenuItem Header="Item 2" ImageSource="..." Command="{Binding Command2}"/>
<r:RibbonSplitMenuItem Header="Item 3" ImageSource="..." Command="{Binding Command3}"/>
</r:RibbonSplitButton>
Run Code Online (Sandbox Code Playgroud)
如果我单击“拆分按钮”的上部,则命令SplitButtonCommand将像通常一样执行一次。
如果我单击SplitButton的底部,然后单击任何菜单项(例如项1),则该项的命令将执行两次。
有人有任何线索导致问题吗?
我有一个RibbonWindow,我的WindowStyle被设置为None,所以我无法理解的是Grip发生了什么调整窗口的大小?!即使我的控件的底部部分的边距设置为0也会被隐藏......这是一种奇怪的行为.
但是如果我改变控件的底部边距就可以了,但无论如何都看不到Grip,可能是因为部分客户区隐藏了......
我不得不说,如果有一个WPF窗口,这不会发生,它只发生在RibbonWindow上.我正在使用RibbonWindow,因为Ribbon在适当的窗口中具有其他外观.
那么我该怎么做才能解决Grip的问题呢?
我的一些代码......
<rib:RibbonWindow x:Class="MyApp.Views.MainView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:rib="clr-namespace:Microsoft.Windows.Controls.Ribbon;assembly=RibbonControlsLibrary"
AllowsTransparency="True"
Background="Transparent"
Height="750"
ResizeMode="CanResizeWithGrip"
Width="1000"
WindowStartupLocation="CenterScreen"
WindowStyle="None">
<Grid Margin="0, 0, 0, 20">
<Border Background="Black"
CornerRadius="5"
Opacity="0.5"/>
</Grid>
</rib:RibbonWindow>
Run Code Online (Sandbox Code Playgroud)
提前致谢!
我添加了一个引用RibbonControlsLibrary.dll
.v4.0.0.11019.然后,我在主窗口中有命名空间声明:
xmlns:r="clr-namespace:Microsoft.Windows.Controls.Ribbon;assembly=RibbonControlsLibrary"
Run Code Online (Sandbox Code Playgroud)
然后我尝试在我的主要外部网格的顶行使用功能区:
</Grid.ColumnDefinitions>
<r:Ribbon Title="ModuleRibbon" Grid.Row="0">
<r:RibbonTab></r:RibbonTab>
<r:RibbonTab></r:RibbonTab>
</r:Ribbon>
Run Code Online (Sandbox Code Playgroud)
这一切给了我一个编译错误说明:
错误25 XML命名空间'clr-namespace中不存在标签'Ribbon':Microsoft.Windows.Controls.Ribbon; assembly = RibbonControlsLibrary'.22号线位置10.
我发现的每个教程和指南都说我做了我做过的事.错误消息没有Google结果 - 减去行和位置以及其他项目特定信息.
救命!
wpf ×11
ribbon ×4
c# ×3
xaml ×3
data-binding ×2
wpf-controls ×2
.net ×1
devexpress ×1
mvvm ×1
selecteditem ×1
system.windows.controls.ribbon ×1
wpftoolkit ×1