This is the problem (unecessary margin showed by the red arrow):
This is the actual XAML of it:
<Ribbon DockPanel.Dock="Top">
This is the patch (which appears to me as working but a hack instead of a real solution):
<Ribbon DockPanel.Dock="Top" Margin="0, -22, 0, 0">
With the patch (more a hack than anything else to me):
Why there is a margin (border/space) at the top of the Ribbon and how to remove that margin properly without a hack (Margin -22 is a hack to me)?
Solution applied (Ed Bayiates solution):
<Ribbon DockPanel.Dock="Top" x:Name="MyRibbon" SizeChanged="RibbonSizeChanged">
private void RibbonSizeChanged(object sender, SizeChangedEventArgs e)
{
ContentPresenter titlePanel = MyRibbon.Template.FindName("PART_TitleHost", MyRibbon) as ContentPresenter;
if (titlePanel != null)
{
double titleHeight = titlePanel.ActualHeight;
MyRibbon.Margin = new Thickness(MyRibbon.Margin.Left, -titleHeight, MyRibbon.Margin.Right, MyRibbon.Margin.Bottom);
}
}