如何在WPF功能区中自定义快速访问工具栏? [英] How do I customize quick access toolbar in WPF ribbon?

查看:182
本文介绍了如何在WPF功能区中自定义快速访问工具栏?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Application中使用WPF功能区。我正在搜索空间为其添加一个标签,根据登录的database.so用户自动更新,我在快速访问工具栏中找到了它。但我希望它是应用程序的最右边的短号。我尝试了文本的Horizo​​ntalAlignment属性,但我不会工作。一般我希望标签出现在右上角。这是xaml:



I'm using WPF ribbon in an Application.I'm searching space to add a label to it which automatically updates according to the logged in user of database.so,I found it in quick access toolbar. but i want it to extreme rightmost cornet of application .I tried the HorizontalAlignment property of text but i won't work.In General I want label appear on Top right corner .Here's xaml:

<Grid>
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto"/>
                <RowDefinition/>
            </Grid.RowDefinitions>
            <Ribbon x:Name="RibbonWin"  SelectedIndex="0">
                <Ribbon.HelpPaneContent>
                    <RibbonButton />
                </Ribbon.HelpPaneContent>
                <Ribbon.QuickAccessToolBar>
                    <RibbonQuickAccessToolBar>
                        <RibbonButton x:Name ="Save" />
                        <RibbonSplitButton x:Name ="Undo" >
                            <RibbonSplitMenuItem Header="Undo 1" />
                            <RibbonSplitMenuItem Header="Undo 2" />
                            <RibbonSplitMenuItem Header="Undo 3" />
                        </RibbonSplitButton>
                    <RibbonSplitButton x:Name="Redo" >
                        <RibbonSplitMenuItem Header="Redo 1" />
                        <RibbonSplitMenuItem Header="Redo 2" />
                    </RibbonSplitButton>
                    <Label Background="White"  Content="Welcome ,USER"/>
                </RibbonQuickAccessToolBar>
                </Ribbon.QuickAccessToolBar>
                ...<a href=""></a><a href=""></a><a href=""></a>
            </Ribbon>
        </Grid>





以下是它的外观:

http://imagizer.imageshack.us/a/img673/2820/ oexwmX.png [ ^ ]

推荐答案

当您希望将登录用户名放在控件的设计参数之外时,为什么要坚持使用已登录的用户名。



Put位于与功能区相同的网格中的只读文本框或文本块中,并将其对齐。



Why do you insist the logged on username is inside the ribbon when you want it to be placed outside the design parameter of the control.

Put is in a readonly textbox or a textblock in the same grid as the ribbon and align it right.

               </Ribbon>
        <textbolck text="{Binding UserName" horizontalalignment="Right" />
</Grid>


这篇关于如何在WPF功能区中自定义快速访问工具栏?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆