gpt4 book ai didi

c# - XamlObjectWriterException : Cannot create unknown type '{http://schemas.microsoft.com/winfx/2006/xaml/presentation}Ribbon'

转载 作者:行者123 更新时间:2023-11-30 23:04:43 32 4
gpt4 key购买 nike

当我在 wpf 应用程序中添加功能区控件时出现此异常。有人可以给我一些关于如何克服它的建议吗?在我的 xaml 代码中,功能区添加在最后一个选项卡中,如您在后面的代码中所见。一切正常,当我添加功能区时问题开始了。

<Window
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:v="clr-namespace:Views;assembly=DemoDataGrid"
Title="Testing GUI app" Width="1200" Height="768">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Menu Margin="0" Grid.Row="0" VerticalAlignment="Top" Background="#FFEAF1FB">
<MenuItem Header="File" IsTabStop="False">
<MenuItem Header="Exit" Command="{Binding FileExit}" />
</MenuItem>
<MenuItem Header="Tools" IsTabStop="False"/>
<MenuItem Header="Help" IsTabStop="False"/>
</Menu>
<ToolBarTray Grid.Row="1" Background="DarkGray"/>
<UserControl Grid.Row="2" IsTabStop="False">
<TabControl Margin="10,50,10,10">
<TabItem Header="Date Picker">
<Grid Background="#FFE5E5E5">
<v:DatePickerView/>
</Grid>
</TabItem>
<TabItem Header="Color Picker">
<Grid Background="#FFE5E5E5">
<v:ColorPickerView/>
</Grid>
</TabItem>
<TabItem Header="Combo Box">
<Grid Background="#FFE5E5E5">
<v:ComboBoxView/>
</Grid>
</TabItem>
<TabItem Header="ExtendedDataGrid">
<Grid Background="#FFE5E5E5">
<v:DGridXtendedView/>
</Grid>
</TabItem>
<TabItem Header="RibbonMenu">
<Grid Background="#FFE5E5E5">
<Ribbon/>
</Grid>
</TabItem>
</TabControl>
</UserControl>
<StatusBar Grid.Row="3" VerticalAlignment="Bottom" Background="#FFEAF1FB">
<StatusBarItem Content="{Binding User}"/>
<Separator />
<StatusBarItem Content="{Binding Status}"/>
</StatusBar>
</Grid>

最佳答案

1.添加对 System.Windows.Controls.Ribbon

的引用

2。将命名空间添加到您的 xaml 文件

xmlns:ribbon="clr-namespace:System.Windows.Controls.Ribbon;assembly=System.Windows.Controls.Ribbon"

关于c# - XamlObjectWriterException : Cannot create unknown type '{http://schemas.microsoft.com/winfx/2006/xaml/presentation}Ribbon' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49194792/

32 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com