CarlosLima
Top achievements
Rank 1
CarlosLima
asked on 29 Nov 2010, 09:30 AM
I know that it possible to copy/paste the grid's content but when I have a custom header, let's say with a textblock on it, how do I set the copy/paste to make sure that when the cells and the header are copied to the clipboard, the header has what I want it to have (and not the textblock class type text...)
Thanks.
Carlos
Thanks.
Carlos
5 Answers, 1 is accepted
0
Hello carlos,
To overcome the problem you need to subscribe to the Copying event of the gridview and set the Header of the particular column to a string:
Now, the clipboard will have the correct header.
Finally, you need to restore the original look of the Header in the Copied event.
Sincerely yours,
Veselin Vasilev
the Telerik team
To overcome the problem you need to subscribe to the Copying event of the gridview and set the Header of the particular column to a string:
<
telerik:GridViewDataColumn
DataMemberBinding
=
"{Binding Name}"
>
<
telerik:GridViewDataColumn.Header
>
<
StackPanel
>
<
TextBlock
Text
=
"my custom header"
/>
<
TextBlock
Text
=
"another line"
/>
</
StackPanel
>
</
telerik:GridViewDataColumn.Header
>
</
telerik:GridViewDataColumn
>
private
void
clubsGrid_Copying(
object
sender, GridViewClipboardEventArgs e)
{
var column =
this
.clubsGrid.Columns[
"Name"
];
if
(column.Header
is
StackPanel)
{
var sp = column.Header
as
StackPanel;
var headerText =
string
.Empty;
foreach
(var tb
in
sp.ChildrenOfType<TextBlock>())
{
headerText += tb.Text +
" "
;
}
column.Header = headerText;
}
}
Now, the clipboard will have the correct header.
Finally, you need to restore the original look of the Header in the Copied event.
Sincerely yours,
Veselin Vasilev
the Telerik team
Browse the videos here>> to help you get started with RadControls for Silverlight
0
David Ocasio
Top achievements
Rank 2
Iron
Veteran
Iron
answered on 09 Jan 2012, 02:48 PM
is there any update on this particular issue
it is not very practical to rewrite the header just for the sake of the clipboard function
and then try and restore it to its original values afterwards.
i would prefer it to show in the CopyingCellClipboardContent event or
act similiar to the elementexporting event
so i can adjust it before it is copied to the clipboard
is there something i am missing
another event.
Any help will be appreciated
thanks
dco
it is not very practical to rewrite the header just for the sake of the clipboard function
and then try and restore it to its original values afterwards.
i would prefer it to show in the CopyingCellClipboardContent event or
act similiar to the elementexporting event
so i can adjust it before it is copied to the clipboard
is there something i am missing
another event.
Any help will be appreciated
thanks
dco
0
Hello dco,
Didie
the Telerik team
I understand your point, but we do not have any update on this functionality.
Kind regards,Didie
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
0
Deborah
Top achievements
Rank 1
answered on 12 Dec 2012, 11:04 AM
Hi,
still no updates on this argument?
Thanks.
still no updates on this argument?
Thanks.
0
Hi,
Didie
the Telerik team
I am afraid that such a functionality is still not supported.
Greetings,Didie
the Telerik team
Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.