I am displaying Mac Address in a WPF application. I want that mac address to be selectable to be copy/paste, so I am using ReadOnly TextBox
When the user double click I want to select the whole MacAddress
The default behavior by the WPF and Windows, is by double click select part of the number between colons so when the mac address is : 00:55:66:77:99
and the user double click, only one part of the mac address (like 55) being selected Is there a way without a code to make the selection for the whole content for textbox
or maybe I should not use textbox?
Thanks
On MouseDoubleClick event of textbox you can call SelectAll() method of textbox to select al the text inside it.
void textBox_MouseDoubleClick(object sender, MouseButtonEventArgs e)
{
(sender as TextBox).SelectAll();
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With