0

I have 3 TabItems in a TabControl. If I press a Button in one of them, the other 2 get disabled. I do this with:

TabItem1.IsEnabled = false;

This works well, but the Color of the TabItem does Change too into transparent. Like in this Picture Is there a way I can disable the TabItems without them changing their color or making the Text atleast readable then the TabItem is disabled?

  • Color as in forecolor (text) or backcolor (background)? Why would you want disabled items to look the same as normal ones? Isn't that confusing for the user? – Caius Jard Feb 03 '22 at 14:38
  • 1
    You can disable selecting the tab by handling [Selecting](https://learn.microsoft.com/en-us/dotnet/api/system.windows.forms.tabcontrol.selecting?view=windowsdesktop-6.0&WT.mc_id=DT-MVP-5003235) event and setting `e.Cancel = true` for that specific tab. But then you may ask, how can I prevent changing the tab header color on mouse hover. – Reza Aghaei Feb 03 '22 at 15:37
  • **TabItem**, not such control in `WinForms`, nor `IsEnabled` property. – dr.null Feb 03 '22 at 17:03
  • Same Color as the enabled one, its not confusing, but if I disable them, they are unreadable. Its more like a Design Problem not a function – Zahlensuppe Feb 04 '22 at 07:11
  • It's more like a style problem then. Just make them readable when disabled by editing the style. A shady look when not clickable is expected and mandatory for a good UX. – Orace Feb 16 '22 at 23:03
  • Does this answer your question? [WPF styling tabitem text foreground upon trigger such as IsEnabled, IsMouseOver, etc](https://stackoverflow.com/questions/1130116/wpf-styling-tabitem-text-foreground-upon-trigger-such-as-isenabled-ismouseover) – Orace Feb 16 '22 at 23:05

0 Answers0