[英]Why is ribbon items not showing on the window?
I'm developing an app, using .NET Core 3.1.我正在开发一个应用程序,使用 .NET Core 3.1。 adding reference to Fluent Ribbon but when I write some XAML nothing shows.
添加对 Fluent Ribbon 的引用,但是当我写一些 XAML 时没有显示。
<Window x:Class="WpfApp2.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:WpfApp2"
xmlns:fluent="urn:fluent-ribbon"
mc:Ignorable="d"
Title="MainWindow" Height="450" Width="800">
<Grid>
<fluent:Ribbon>
<fluent:Ribbon.Menu>
<fluent:Backstage>
<fluent:BackstageTabControl>
<fluent:BackstageTabItem Header="Database">
<WrapPanel Orientation="Horizontal">
<WrapPanel Orientation="Vertical">
<fluent:Button Header="Open Database" Foreground="Black" />
<fluent:Button Header="Save Database" Foreground="Black" />
<fluent:Button Header="Do something" Foreground="Black" />
</WrapPanel>
<fluent:TextBox Header="Database Name" Text="Your Database" Foreground="Black"/>
</WrapPanel>
</fluent:BackstageTabItem>
<fluent:Button x:Name="ExitButton" Header="Exit" />
</fluent:BackstageTabControl>
</fluent:Backstage>
</fluent:Ribbon.Menu>
</fluent:Ribbon>
</Grid>
</Window>
Any idea what I'm doing wrong?知道我做错了什么吗?
You don't seem to have added any items to the Ribbon
.您似乎没有向
Ribbon
添加任何项目。 You have only set the Menu
property.您只设置了
Menu
属性。
Try to add a RibbonTabItem
to the Ribbon
as they do in this basic setup :尝试像在此基本设置中那样将
RibbonTabItem
添加到Ribbon
:
<Fluent:RibbonWindow x:Class="MyFirstRibbonProject.MyFirstWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:Fluent="urn:fluent-ribbon"
Title="My first RibbonWindow"
Width="800"
Height="600">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Fluent:Ribbon Grid.Row="0">
<!--Backstage-->
<Fluent:Ribbon.Menu>
<Fluent:Backstage>
</Fluent:Backstage>
</Fluent:Ribbon.Menu>
<!--Tabs-->
<Fluent:RibbonTabItem Header="Home">
<Fluent:RibbonGroupBox Header="Group">
<Fluent:Button Header="Green"
Icon="Resource-Path to your small icon for this button"
LargeIcon="Resource-Path to your large icon for this button" />
<Fluent:Button Header="Grey"
Icon="Resource-Path to your small icon for this button"
LargeIcon="Resource-Path to your large icon for this button" />
</Fluent:RibbonGroupBox>
</Fluent:RibbonTabItem>
</Fluent:Ribbon>
<Grid Grid.Row="1">
<TextBlock>My first window containing a Ribbon and something else.</TextBlock>
</Grid>
</Grid>
</Fluent:RibbonWindow>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.