Skip to content

Conversation

AikoAppeldorn
Copy link

@AikoAppeldorn AikoAppeldorn commented Oct 30, 2017

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.

@AikoAppeldorn AikoAppeldorn changed the title Custom effect text Added custom effect text Oct 30, 2017
Copy link
Owner

@punker76 punker76 left a 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; }


Copy link
Owner

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);
Copy link
Owner

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)

Copy link
Contributor

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.

Copy link
Owner

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.

@punker76 punker76 added this to the v1.2.0 milestone Nov 1, 2017
@punker76 punker76 merged commit f819cbe into punker76:dev Nov 4, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants