Telerik WPF RibbonBar 通过数据绑定填充

发布于 2024-08-24 10:33:34 字数 2858 浏览 2 评论 0原文

我有一个对象模型,一个 UserProfile,它包含许多 ServiceProfile,每个 ServiceProfile 包含许多 CommandProfile。 我已将此模型与 Telerik WPF OutlookBar 绑定:

<telerikNavigation:RadOutlookBar

                                ItemsSource="{Binding ServiceProfiles}"
                                Background="{Binding Color}">
                                <telerikNavigation:RadOutlookBar.TitleTemplate>
                                    <DataTemplate>
                                        <Label Content="{Binding Description}"/>
                                    </DataTemplate>
                                </telerikNavigation:RadOutlookBar.TitleTemplate>
                                <telerikNavigation:RadOutlookBar.ItemTemplate>
                                    <DataTemplate>
                                        <Label Content="{Binding Description}"/>
                                    </DataTemplate>
                                </telerikNavigation:RadOutlookBar.ItemTemplate>
                                <telerikNavigation:RadOutlookBar.ContentTemplate>
                                    <DataTemplate>
                                        <ListBox ItemsSource="{Binding CommandProfiles}" Background="Transparent">
                                            <ListBox.ItemTemplate>
                                                <DataTemplate>
                                                    <Button 
                                                        Content="{Binding Description}"
                                                        Command="{Binding ExecuteCommand}"
                                                        />
                                                </DataTemplate>
                                            </ListBox.ItemTemplate>
                                        </ListBox>
                                    </DataTemplate>
                                </telerikNavigation:RadOutlookBar.ContentTemplate>
                            </telerikNavigation:RadOutlookBar>

此 XAML 代码为每个 ServiceProfile 创建一个 OutlookbarItem。每个 OutlookbarItem 都呈现一个按钮列表作为内容。

我无法使用 RibbonBar 完成类似的工作:在单个选项卡(指我的 UserProfile)内,我想为每个 ServiceProfile 创建一个 RibbonGroup。每个组(服务配置文件)内有许多功能区按钮,每个命令配置文件对应一个。 但我无能为力。

我到达此代码:

 <telerikRibbonBar:RadRibbonTab 
                x:Name="theTab"
                Header="{Binding Description}" 
                Background="{Binding Color}"
                ItemsSource="{Binding ServiceProfiles}">

            </telerikRibbonBar:RadRibbonTab>

它创建了功能区组,但我无法控制任何内容(组的标题,填充(通过绑定)内容。

有什么想法吗?

谢谢

Marco Parenzan

I have and object model, a UserProfile, that contains many ServiceProfile, each containing many CommandProfile.
I have bound this model with Telerik WPF OutlookBar:

<telerikNavigation:RadOutlookBar

                                ItemsSource="{Binding ServiceProfiles}"
                                Background="{Binding Color}">
                                <telerikNavigation:RadOutlookBar.TitleTemplate>
                                    <DataTemplate>
                                        <Label Content="{Binding Description}"/>
                                    </DataTemplate>
                                </telerikNavigation:RadOutlookBar.TitleTemplate>
                                <telerikNavigation:RadOutlookBar.ItemTemplate>
                                    <DataTemplate>
                                        <Label Content="{Binding Description}"/>
                                    </DataTemplate>
                                </telerikNavigation:RadOutlookBar.ItemTemplate>
                                <telerikNavigation:RadOutlookBar.ContentTemplate>
                                    <DataTemplate>
                                        <ListBox ItemsSource="{Binding CommandProfiles}" Background="Transparent">
                                            <ListBox.ItemTemplate>
                                                <DataTemplate>
                                                    <Button 
                                                        Content="{Binding Description}"
                                                        Command="{Binding ExecuteCommand}"
                                                        />
                                                </DataTemplate>
                                            </ListBox.ItemTemplate>
                                        </ListBox>
                                    </DataTemplate>
                                </telerikNavigation:RadOutlookBar.ContentTemplate>
                            </telerikNavigation:RadOutlookBar>

This XAML code creates a OutlookbarItem for each ServiceProfile. Each OutlookbarItem presents a list of buttons as a content.

I'm not able to do the analogous job with ribbonBar: inside a single tab (referring to my UserProfile), I want to create a RibbonGroup for each ServiceProfile. Inside each Group (Service profile) there are many Ribbonbuttons, one for each CommandProfile.
But I'm not able.

I arrive to this code:

 <telerikRibbonBar:RadRibbonTab 
                x:Name="theTab"
                Header="{Binding Description}" 
                Background="{Binding Color}"
                ItemsSource="{Binding ServiceProfiles}">

            </telerikRibbonBar:RadRibbonTab>

which creates the ribbongroups, but I'm not able to control anything (title of the group, fill (via Binding) the content.

Any idea?

Thanks

Marco Parenzan

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

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

发布评论

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

评论(1

翻了热茶 2024-08-31 10:33:34

有点晚了,但抱歉地说,但它看起来还不支持:

http://www.telerik.com/community/forums/silverlight/ribbonbar/headertemplate-of-radribbontab.aspx

你好,亚历克斯·范,

不幸的是,RibbonBar 目前不支持数据绑定。不过,您可以在我们的 PITS 中为此功能投票,从而提高其优先级。

对于您的情况,最好是以编程方式添加功能区项目。

如果您需要更多信息,请告诉我们。

一切顺利,
蒂娜·斯坦切娃
Telerik 团队

Bit late, but sorry to say but it doesn't look supported yet:

http://www.telerik.com/community/forums/silverlight/ribbonbar/headertemplate-of-radribbontab.aspx

Hello Alex Fan,

Unfortunately the RibbonBar doesn't support databinding for now. However, you can put your vote for this feature in our PITS thus increasing its priority.

In your case the best will be if you add the ribbon items programmatically.

Let us know if you need more info.

All the best,
Tina Stancheva
the Telerik team

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