I have a datagrid in which I have certain columns for which I’ve modified their string format such as this, which takes in a UINT32 number and outputs its hex format.
<WpfToolkit:DataGridTextColumn Binding="{Binding Path=getStart, Mode=OneWay, StringFormat='{}{0:x4}'}" Header="Starting Address" Width="13*"/>
When I copy a row however, I get the UINT number again instead of the hex, as I would have liked. Is there a way to preserve the string format? I’ve looked into CopyingRowClipboardContent but I’m not quite sure how to use this event handler properly. Any help?
You can try do something like that:
1) Add property getStartS type of string to your class and in getter you can format your string.
2) In DataGrid column you can bind to getStartS property and it’ll work properly!
Or you can try second solution:
DataGrid column:
Event handler: