Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/306.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# XamlObjectWriterException:无法创建未知类型';{http://schemas.microsoft.com/winfx/2006/xaml/presentation}色带';_C#_Wpf_Xaml_F#_Ribbon - Fatal编程技术网

C# XamlObjectWriterException:无法创建未知类型';{http://schemas.microsoft.com/winfx/2006/xaml/presentation}色带';

C# XamlObjectWriterException:无法创建未知类型';{http://schemas.microsoft.com/winfx/2006/xaml/presentation}色带';,c#,wpf,xaml,f#,ribbon,C#,Wpf,Xaml,F#,Ribbon,在wpf应用程序中添加Ribbon控件时,出现此异常。有人能给我一些关于如何度过难关的建议吗?在我的xaml代码中,功能区添加在最后一个选项卡中,正如您在下面的代码中看到的那样。一切都正常,当我添加功能区时问题就开始了 <Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:v=

在wpf应用程序中添加Ribbon控件时,出现此异常。有人能给我一些关于如何度过难关的建议吗?在我的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的引用

二,。 将名称空间添加到xaml文件中

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

听起来你缺少一个程序集引用。你能给我们看一些xaml代码吗?我用xaml代码编辑了原始文章。你使用FsXAML吗?是的,我使用FsXAML。谢谢,这就解决了问题!