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

  • SEARCH
  • Home
  • 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 7965777
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T06:14:44+00:00 2026-06-04T06:14:44+00:00

I am coding a function which will take a Control Ctrl as Arguement and

  • 0

I am coding a function which will take a Control Ctrl as Arguement and Modify the Control.Content of it.
Is there Any way to Get and Set the Content of any Control??

Code :

void RemoveHotKey(Control Ctrl, int KeyIndex)
{
    if (Ctrl.Content.ToString().Substring(KeyIndex, 1) == "_") // System.Windows.Controls.Control does not contain a definition for 'Content'
    {
        Ctrl.Content = Ctrl.Content.ToString().Remove(KeyIndex, 1); // System.Windows.Controls.Control does not contain a definition for 'Content'
    }
}
  • 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-04T06:14:46+00:00Added an answer on June 4, 2026 at 6:14 am

    try this instead:

    void RemoveHotKey(ContentControl Ctrl, int KeyIndex) 
    { 
        if (Ctrl.Content.ToString().Substring(KeyIndex, 1) == "_")
        { 
            Ctrl.Content = Ctrl.Content.ToString().Remove(KeyIndex, 1);
        } 
    }
    

    take a look here.

    or this:

    void RemoveHotKey(Control Ctrl, int KeyIndex)
    {
        ContentControl contentCtrl = Ctrl as ContentControl;
        if (contentCtrl != null && contentCtrl.Content != null)
        {
            if (contentCtrl.Content.ToString().Substring(KeyIndex, 1) == "_")
            { 
                contentCtrl.Content = contentCtrl.Content.ToString().Remove(KeyIndex, 1);
            }
        } 
    }
    

    which is way less expensive than using reflection..

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Coding footer naively, if there's not enough content, then there will be empty space
I am coding a basic traffic light control which will be displayed on the
I'm now developing one JS UDF which seems following coding. <script> <!-- function alertmsg()
I am coding a desktop project which will includes several classes, and will put
I'm writing a little function library in PHP to simplify my routine coding tasks,
When coding, I use Dropbox to sync folder in which I keep my projects
I'm working on an API which will read string values from a file and
I'm writing something that will examine a function and rewrite that function in another
When coding new javascript heavy websites, which order or web browser do you code
I have a function addIt, which adds data to the database whatever is 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.