can I customize the RecentDocumentMenu tooltip ?

Ribbon for WPF Forum

Posted 11 years ago by Jake Gordon
Version: 4.5.0480
Avatar
Is there a way to override the tooltips on the recent documents menu ? I'd like to show a friendlier tooltip than the full path, similar to the way MSWord does, if the file is in the current users "My Documents" folder or on their desktop...

e.g. show

"Desktop\foo.txt"

instead of

"C:\Documents and Settings\Jake\Desktop\foo.txt"

It seems that the System.URI used by the recent document manager is expected to be a full path, it has trouble if I pass in a relative one.

e.g. using

new Uri("Desktop\foo.txt", UriKind.Relative)

results in the following exception:

This operation is not supported for a relative URI.

------------------------------------------------------

at System.Uri.get_LocalPath()
at ActiproSoftware.Windows.DocumentManagement.DocumentReference.a(DependencyObject A_0, DependencyPropertyChangedEventArgs A_1)
at System.Windows.DependencyObject.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
at System.Windows.DependencyObject.NotifyPropertyChange(DependencyPropertyChangedEventArgs args)
at System.Windows.DependencyObject.UpdateEffectiveValue(EntryIndex entryIndex, DependencyProperty dp, PropertyMetadata metadata, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, Boolean coerceWithDeferredReference, OperationType operationType)
at System.Windows.DependencyObject.SetValueCommon(DependencyProperty dp, Object value, PropertyMetadata metadata, Boolean coerceWithDeferredReference, OperationType operationType, Boolean isInternal)
at System.Windows.DependencyObject.SetValue(DependencyProperty dp, Object value)
at ActiproSoftware.Windows.DocumentManagement.DocumentReference.set_Location(Uri value)
at ActiproSoftware.Windows.DocumentManagement.DocumentReference..ctor(Uri location)
at ActiproSoftware.Windows.DocumentManagement.RecentDocumentManager.NotifyDocumentOpened(Uri location, String name, Object tag)
at ActiproSoftware.Windows.DocumentManagement.RecentDocumentManager.NotifyDocumentOpened(Uri location)


Thanks!
- Jake

Comments (5)

Posted 11 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Jake,

The default template for RecentDocumentMenu is this:
<Setter Property="ItemTemplate">
    <Setter.Value>
        <DataTemplate DataType="shared:IDocument">
            <ribbonControls:Button Style="{StaticResource RecentDocumentButtonStyle}"
                    Label="{Binding Name}" ScreenTipHeader="{Binding Location}" ScreenTipDescription=""
                    />
        </DataTemplate>
    </Setter.Value>            
</Setter>
Just change the ScreenTipHeader to bind to something else, maybe the Tag property if you have that set on the DocumentReference.


Actipro Software Support

Posted 9 years ago by John Howe
Avatar
Hi,

Very dumb question from a WPF newbie but where and how to I make the changes you list above? We have all the required source I just can't work out where to place the xaml snippet in our application.

Regards

John
Posted 9 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hello,

You would probably want to put this inside an implicit style in your application resources.
<Style x:Key="{x:Type ribbon:RecentDocumentMenu}" TargetType="{x:Type ribbon:RecentDocumentMenu}">
    ...
</Style>
An implicit style like this that is placed in your application resources will have application-wide effects.

Please let us know if you have further questions.

[Modified at 11/11/2010 02:59 PM]


Actipro Software Support

Posted 8 years ago by Anoop Jose
Avatar
Hello,

From where can I get RecentDocumentButtonStyle ?
I am getting a (Ctrl+O) along the tool tip of recent document menu which needs to be avoided.

Thanks in advance.
Posted 8 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Anoop,

It appears that there is a bug that was introduced in build 542 that allowed "(Ctrl+O)" to be appended to the screen tip. Previous builds had blocked that.

If you are a WPF Studio customer, you can download the default WPF Studio styles from your account. Otherwise you can write our support address with your license information to request the default Ribbon styles.

You'd want to modify the RecentDocumentMenu default style by appending InputGestureText="" to each instance of ribbonControls:Button (3 places) in it, like:
<ribbonControls:Button AutomationProperties.AutomationId="{Binding Name}" Style="{StaticResource MediumRecentDocumentButtonStyle}"
    Label="{Binding Name}" ScreenTipHeader="{Binding Location}" ScreenTipDescription="" InputGestureText="" />
We've made these changes for the next version.


Actipro Software Support

The latest build of this product (v2019.1 build 0683) was released 1 month ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.