-
Notifications
You must be signed in to change notification settings - Fork 410
Added custom effect text #263
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thx for contributing!
/// </summary> | ||
public string EffectText { get; set; } | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you remove the extra empty line? thx
{ | ||
switch (effect) | ||
{ | ||
case DragDropEffects.All: | ||
// TODO: Add default template for EffectAll | ||
return GetEffectAllAdornerTemplate(target); | ||
case DragDropEffects.Copy: | ||
return GetEffectCopyAdornerTemplate(target) ?? CreateDefaultEffectDataTemplate(target, IconFactory.EffectCopy, "Copy to", destinationText); | ||
return GetEffectCopyAdornerTemplate(target) ?? CreateDefaultEffectDataTemplate(target, IconFactory.EffectCopy, effectText == null ? "Copy to" : effectText, destinationText); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So maybe it's also good to check string.IsNullOrEmpty(effectText)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We used to have the code like your suggestion but we needed an empty string instead of "move to".
With string.IsNullOrEmpty(effectText) the empty string would have been replaced with "Move to". A workaround would have been to set the effectText to " " but the additional whitespace doesn't look good.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right, so it's ok for me.
Custom effect text
I've added the feature to customize the text which pops up when you drag an item by adding an optional argument to the GetEffectAdornerTemplate function.
Before, you only could choose between "Move to", "Copy to", "Link to" and no text at all.
If you leave the string empty or null the default strings will be used.
I extended the IDropInfo interface with the EffectText string.