Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8330739
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T02:12:27+00:00 2026-06-09T02:12:27+00:00

I have a datagrid in which I have certain columns for which I’ve modified

  • 0

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?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T02:12:28+00:00Added an answer on June 9, 2026 at 2:12 am

    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.

     public class Foo
        {
            public int getStart { get; set; }
    
            public string getStartS { get { return string.Format("{0:x4}", getStart); } }
        }
    

    2) In DataGrid column you can bind to getStartS property and it’ll work properly!

    <DataGridTextColumn Binding="{Binding Path=getStartS}" 
                                        Header="Starting Address"                                    
                                        />
    

    Or you can try second solution:

    DataGrid column:

    <DataGridTextColumn Binding="{Binding Path=getStart, Mode=OneWay, StringFormat='{}{0:x4}'}" 
                                        Header="Starting Address"
                                        CopyingCellClipboardContent="DataGridTextColumn_CopyingCellClipboardContent"
                                        />
    

    Event handler:

     private void DataGridTextColumn_CopyingCellClipboardContent(object sender, DataGridCellClipboardEventArgs e)
            {
                if (e.Column.ClipboardContentBinding != null && !string.IsNullOrEmpty(e.Column.ClipboardContentBinding.StringFormat))
                {
                    e.Content = string.Format(e.Column.ClipboardContentBinding.StringFormat, e.Content);
                }
            }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this datagrid which has columns with a NumericStepper as an itemEditor where
I have a asp:DataGrid which holds data in two columns on my webpage. The
I have a datagrid which lists products and their market share - (dgProd). That
I have a datagrid which consists of a checkbox and couple of columns. When
I have a datagrid which gets data like this: public struct MyData { public
I have a datagrid which the user can add records to. If a certain
I have a dataGrid which consists of 3 columns (ID) (Name) (Surname). How do
I have a Datagrid which looks as under <asp:GridView ID=dgTask runat=server Width=100% AutoGenerateColumns=False> <Columns>
I have a DataGrid which I am binding to a PagedCollectionView which is grouped
I have a DataGrid which is being bound dynamically to a database query. The

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.