Hi,
I'd like to know how I can use the copy and paste on objects of type custom using InlineUIContainer class.
I did some tests, but I could not duplicate the object, also using an override CopyableInlineUIContainer with the functions CopyPropertiesFromOverride/CopyContentFromOverride.
The object of type InlineUIContainer contains a control RadButton whose content is an image. I also linked to the button RadButton an event MouseDoubleClick to show custom dialog box.
This is a sample code:
If I try to duplicate the object, only the comment is actually copied.
Is there any solution for this?
Thanks,
Michele Fochi
I'd like to know how I can use the copy and paste on objects of type custom using InlineUIContainer class.
I did some tests, but I could not duplicate the object, also using an override CopyableInlineUIContainer with the functions CopyPropertiesFromOverride/CopyContentFromOverride.
The object of type InlineUIContainer contains a control RadButton whose content is an image. I also linked to the button RadButton an event MouseDoubleClick to show custom dialog box.
This is a sample code:
string
controlName =
"PLACEHOLDER_"
+ getNewId();
// ex. PLACEHOLDER_1
string
controlTag = getNewTag();
// ex. 100231
var button =
new
RadButton
{
Name = controlName,
Tag = controlTag,
// this tag is used to retrieve custom properties from database
Width = 100,
Height = 32,
};
// add the image to content
button.Content =
this
.getCustomUIElementByPlaceholder(message, controlName);
button.MouseDoubleClick += SelectPlaceHolder;
// event fired when user doubleclick the button
// create the UI element
// new class with copyable=true override
var container =
new
CopyableInlineUIContainer { UiElement = button, Width = button.Width, Height = button.Height, Tag = controlName };
// original code
// var container = new InlineUIContainer { UiElement = button, Width = button.Width, Height = button.Height, Tag = controlName };
// invoke the insert method
// Note: editor if a WPF control of type RadRichTextBox
editor.InsertInline(container);
// add a text coomment
string
sContentComment =
"Custom placeholder NAME "
+ controlName +
" TAG "
+ controlTag;
var comment =
new
Comment(sContentComment) { Name =
string
.Concat(
"m"
, controlTag) };
editor.ShowComments =
true
;
var startPosition = editor.Document.CaretPosition;
var endPosition =
new
DocumentPosition(startPosition);
startPosition.MoveToCurrentWordStart();
endPosition.MoveToCurrentWordEnd();
editor.Document.Selection.AddSelectionStart(startPosition);
editor.Document.Selection.AddSelectionEnd(endPosition);
editor.Document.InsertComment(startPosition, endPosition, comment);
If I try to duplicate the object, only the comment is actually copied.
Is there any solution for this?
Thanks,
Michele Fochi