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'
}
}
try this instead:
take a look here.
or this:
which is way less expensive than using reflection..