I want to build a RibbonApplicationMenu
. Within it shall be a nested RibbonApplicationMenuItem
or RibbonApplicationSplitMenuItem
, e.g. likes this:
<ribbon:RibbonApplicationSplitMenuItem x:Name="item1" Header="open project" ImageSource="../img/img1.png">
<ribbon:RibbonApplicationMenuItem x:Name="item11" Header="sub1" ImageSource="../img/img2.png" />
<ribbon:RibbonApplicationMenuItem x:Name="item12" Header="sub2" ImageSource="../img/img3.png" />
<ribbon:RibbonApplicationMenuItem x:Name="item13" Header="sub3" ImageSource="../img/img3.png" />
</ribbon:RibbonApplicationSplitMenuItem>
At first there is no error shown and the program can be built successfully.
When I continue work the entire section is labeled and an error is given: "The index '0' is out of the valid range of the PathParameters-List with the length '0' ".
What is the reason for this error?
This is very easy to understand and to fix, but there is no real need to do that.
The Reason
The issue is that in the standard ribbon templates there are many wrong placeholders
The Fix
Long story short, you need to change the above into, for example:
How to do that?
That's not trivial, but you can do it with a little of attention..
You have to add a reference to
PresentationFramework.Classic
Then, let me start from the end... the objective is defining the following
The missing control templates
What is still missing? Three very big pieces of code containing the above
ControlTemplates
... but there is a trick to include them:RibbonApplicationMenuItem
and locate theTemplate
in theProperties Window
click on the right
Ambient
and selectConvert to New Resource...
In conclusion you will run an overall replace from
(0)
toZero
through all of your xaml.Again, this is intended as a pure academic exercise.