public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if (value == null)
            {
                return(null);
            }
            RibbonPage rb = (RibbonPage)value;
            int        currentPageindex = rb.PageCategory.Pages.IndexOf(rb);

            return(currentPageindex == 0 ?  new Thickness(PageOffsetHelper.GetPageOffset(rb.Ribbon), 0, 0, 0) : (Thickness)rb.FindResource(new RibbonPageThemeKeyExtension()
            {
                ResourceKey = RibbonPageThemeKeys.CaptionControlMargin
            }));
        }
 public static void SetPageOffset(DependencyObject target, PageOffsetHelper value)
 {
     target.SetValue(PageOffsetProperty, value);
 }