Strange Ribbon error in Visual Studio when building

I'm receiving a strange error in Visual Studio when building my WPF application with .NET 4.5 in Visual Studio 11.

My WPF XAML markup is as follows:

<RibbonWindow x:Class="Fablelane.DesktopApplication.CreateStory"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="Create new story" Height="468" Width="526">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition />
        </Grid.RowDefinitions>
        <Ribbon>
            <Ribbon.ApplicationMenu>
                <RibbonApplicationMenu>
                </RibbonApplicationMenu>
            </Ribbon.ApplicationMenu>
            <RibbonTab Margin="0" Header="Format">
                <RibbonGroup Header="Font">
                    <StackPanel Orientation="Horizontal">
                        <RibbonComboBox>
                            <RibbonGallery SelectedValue="Heading 1"
                          SelectedValuePath="Content"
                          MaxColumnCount="1">
                                <RibbonGalleryCategory>
                                    <RibbonGalleryItem Content="Heading 1" Foreground="#16ea00" FontSize="20" />
                                    <RibbonGalleryItem Content="Heading 2" Foreground="#00c6ff" FontSize="18" />
                                    <RibbonGalleryItem Content="Heading 3" Foreground="#999999" FontSize="16" />
                                    <RibbonGalleryItem Content="Heading 3" Foreground="#707070" FontSize="14" />
                                    <RibbonGalleryItem Content="Content" Foreground="#FF606060" />
                                </RibbonGalleryCategory>
                            </RibbonGallery>
                        </RibbonComboBox>
                    </StackPanel>
                    <RibbonControlGroup Margin="2">
                        <RibbonToggleButton Label="B"
    FontWeight="Bold" FontFamily="Times New Roman" Padding="2" />
                        <RibbonToggleButton Label="I"
    FontStyle="Italic" FontFamily="Times New Roman" Padding="2" />
                        <RibbonToggleButton Label="U" FontFamily="Times New Roman" Padding="2,2,2,0" />
                    </RibbonControlGroup>
                </RibbonGroup>
            </RibbonTab>
            <RibbonTab Margin="0" Header="Options">
            </RibbonTab>
        </Ribbon>
        <RichTextBox Grid.Row="1">

        </RichTextBox>
    </Grid>
</RibbonWindow>

Now, when I build, I receive the error:

Unknown build error, 'Method 'get_Command' in type 'System.Windows.Controls.Ribbon.RibbonGallery' from assembly 'System.Windows.Controls.Ribbon, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' does not have an implementation.

When I remove the RibbonGallery element from the code, it compiles and runs just fine.

It should probably be noted that I can easily see the designer view rendering just fine in Visual Studio with the RibbonGallery element inside of it. It just fails during build.

Upvotes: 1

Views: 1388

Answers (3)

Dave
Dave

Reputation: 1209

We had this same issue going from 4.0 to 4.8, but we had to remove and re-add the correct system.dll to the references.

Upvotes: 1

Phil
Phil

Reputation: 42991

I can't see a problem.

If I look at the Ribbon assembly using DotPeek, then I can see the Command property

public ICommand Command
{
  get
  {
    return (ICommand) this.GetValue(RibbonGallery.CommandProperty);
  }
  set
  {
    this.SetValue(RibbonGallery.CommandProperty, (object) value);
  }
}

but then you don't seem to be using it.

Is it worth creating a new test app from scratch?

Upvotes: 1

Rohit Sharma
Rohit Sharma

Reputation: 6490

To me it looks like a bug, why don't you use reflector and check if the ICommand's getter is rightly exposed?

Upvotes: 1

Related Questions