Checkbox WPF – Making checkbox readonly in WPF


As the title suggests, following is the way by which you can make a checkbox readonly in WPF.
Let’s have a look at typical checkbox XAML –
<CheckBox Content="CheckBox" Name="checkBox1" />
Now to make this checkbox read only – we need to add two following properties to XAML statement above.

Those two Properties are – IsHitTestVisible and Focusable
Make thse two properties to False. This makes the readonly checkbox in WPF.
So final XAML statement will be as follows for readonly checkbox in WPF –  

<CheckBox Content="CheckBox" Name="checkBox1" IsHitTestVisible="False" Focusable="False"/> 

Hope this helps.

Cheers…

Happy Coding!!

Comments

Popular posts from this blog

Run Android emulator and Android Studio on Azure VM using Hyper V

The request has both SAS authentication scheme and 'Bearer' authorization scheme. Only one scheme should be used

Azure AD Token Generator using .NET Core