Ribbon Control using with VB.Net

Nov 27, 2008 at 4:19 PM
Hello

I try to get the Ribbon Control to work in an VB.Net WPF-Application. Some things are not as easy for me as the C# documentation makes it look like.
1)

<r:Ribbon DockPanel.Dock="Top"

          Title="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=Title}">


Error message is: "AncestorType" has for "RelativeSource" to be defined in FindAncestor-Mode. (Sorry, but I had to translate the german error message)

2)

        public MainWindow()

        {

            this.Resources.MergedDictionaries

                .Add(Microsoft.Windows.Controls

                      .Ribbon.PopularApplicationSkins.Office2007Black);


I have no clue what to do in VB.Net.

Hopefully someone has some ideas what code to write where in VB.Net.
Regards
--
Carsten



Dec 1, 2008 at 8:10 PM

Hi Carsten,

Were you able to get this working?  I tried a very simple repro in a VB app and it works for me:

 
<Window x:Class="Window1"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:ribbon="clr-namespace:System.Windows.Controls.Ribbon;assembly=RibbonControlsLibrary"
    Title="Window1" Height="300" Width="300">
    <Grid>
    <ribbon:Ribbon Title="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=Title}" x:Name="ribbon" >
    </ribbon:Ribbon>
  </Grid>
</Window>

Can you provide more info if you're having problems?

Also, a great tool for converting c# to VB can be found at http://www.developerfusion.com/tools/convert/csharp-to-vb.   The tool converted the above C# to:

Public Sub New()
   
    Me.Resources.MergedDictionaries.Add(Microsoft.Windows.Controls.Ribbon.PopularApplicationSkins.Office2007Black)
   
End Sub

 

 

Dec 3, 2008 at 8:55 AM

Hello Carol,

thanks for your help. Up to now I got it working. I have still some questions about what to do best to achive for example buttons with different size, where to put dynamic changing things an so on but I will ask these things on detail one after the other.

Regards

Carsten