I'm wondering if anyone else has ran into this issue.
I'm having an issue when copying data from the XamGrid to the clipboard. I have a template column that contains a hyperlink control that represents a customer # in our database. I allow the users to select columns and rows that they want to copy and then click ctrl-c to copy the data to the clipboard. But when they paste it into excel, word, notepad, etc., the customer # column is blank. The header is there, but the data is not. How can keep the column a hyperlink and have the actual data present for export?
Below is the code for template column as well as the class that is used to convert the value into an URI.
Thanks
Hello lonnie3072,
I have been looking into your posts and I have been trying to reproduce your issue with no success. Instead of unbound field with HyperlinkButton I am using our XamGrid’s HyperlinkColumn. I am sending you my sample application(XamGridHyperlink.zip). Please tell me if I have misunderstood you.
I am looking forward to hearing from you.
Using the Hyperlink column does allow the copy function to work properly.
But the issue is that I don't won't to display the actual link in the grid. I want to display a customer # such as 234523 that is a hyperlink like http://www.mypage.com/search.aspx?QueryCustomerID=234523 that will load that's customer's information.
Is there a way to do that with the hyperlink column? If so, I was unable to find any examples of it.
Hello loonie3072,
I have been looking into your post. Do you mean that you cannot make the values into the HyperlinkColumn behave as hyperlinks? If it is so I have managed to achieve that in the sample application(XamGridHyperlinkModified.zip) that I have attached in my previous post.
In your data datasource, you have a string property that contains the url.
In my project, I'm using a converter class that returns the url as a string. I can return that string to both content and contentbinding and see it in the column. The url is underlined when the mouse hovers over it indicating it's a hyperlink, but nothing happens once you click it. I've attached a small screenshot of one of the link's being highlighted. I've also attached my code for the column and the Converter class that I'm using.
Hyperlink Column Code
<ig:HyperlinkColumn Content="{Binding CustomerNumber, Converter={StaticResource Conv}}" ContentBinding="{Binding CustomerNumber, Converter={StaticResource Conv}}" Key="CustomerNumber" HeaderText="Customer #" TargetName="_blank"></ig:HyperlinkColumn>
Converter Class
public class Conv : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
if (value is int)
string sCSHURL = "../customerservicehistory/search.aspx?QueryCustomerID={0}";
if (App.Current.Resources.Contains("CSHURL"))
sCSHURL = App.Current.Resources["CSHURL"].ToString() + "={0}";
}
return string.Format(sCSHURL, value);
return null;
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
throw new NotImplementedException();
Hello Lonnie3072,
I have been looking into your post and I understand your concerns. In your case the HyperlinkColumn refers to property ‘CustomerNumber’ that does not return an URI. In order to achieve the functionality that you want you can use ValueConverter like:
<ig:HyperlinkColumn Key="CustomerNumber" ValueConverter=”{StaticResource Conv}” HeaderText="Customer #" TargetName="_blank"></ig:HyperlinkColumn>
If you need any further assistance, feel free to ask.
Using the below code, I do have the customer # column appearing the way that I want and the hyperlink works as expected.
When I copy / paste the grid into excel, the customer number column ends up being the value of the url, not the customer #. Is there a way to have the customer # copied instead of the url?
New grid with column displaying column number that is a hyperlink.
I'm selecting all the rows and clicking ctrl-c to copy the data from the grid.
New Hyperlink Column markup
<ig:HyperlinkColumn ContentBinding="{Binding CustomerNumber}" ValueConverter="{StaticResource Conv}" Key="CustomerNumber" HeaderText="Customer #" TargetName="_blank"></ig:HyperlinkColumn>
I am just checking if you require any further assistance on the matter.
I have been looking into your post and I can suggest using the Microsoft’s class ‘Clipboard’ in order to manipulate the data which is associated to the Copy Clipboard operation :
http://msdn.microsoft.com/en-us/library/system.windows.forms.clipboard.aspx
This way you can replace the URL with the corresponding Customer # handling the ‘ClipboardCopying’ event of the XamGrid and using Clipboard’a methods ‘GetText’ and ‘SetText’.
If you have any other questions, feel free to ask.
The grid is working just like we want it to. It displays the 'Customer #' but is a hyperlink that opens the page successfully.
When we press 'ctrl-c' to copy that data from the grid, we want that column to be pasted as plain text with just the 'Customer #'.
As is, it paste plain text, but it's the underlying URL. We do not want the URL, just the 'Customer #'.
I have been looking into your post and copying the URL, instead of the customer # is the expected result from the copy operation. I was wondering how exactly would you like this column's valuesto be presented in Excel : plain text only or hyperlink, like in the XamGrid ?