Re: WPF TabControl - Hiding tab buttons conditionally



Hello,

ok, I misunderstood your question here.

TabItem inherits from HeaderedContentControl. As such, it should have a Header.

You can try to set the header content to null with a style trigger. Or manipulate the HeaderTemplate property.

Albeit from that, I don't have any other idead.

Kind regards,
Henning Krause

"drewnoakes" <drewnoakes@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message news:2A916FFD-47A1-4DA2-8BA4-8D3EB3D7B441@xxxxxxxxxxxxxxxx
Hi Henning,

I tried this, but my trigger caused the entire tab page to disappear. My
situtation involves hiding the tab buttons when there's only one tab page to
display, and introducing the buttons when extra pages are added. Perhaps
I've misunderstood your suggestion or my implementation wasn't correct.

Drew.

"Henning Krause [MVP - Exchange]" wrote:

Hello,

you should be able to add a style.trigger to the tabitem element and switch
the IsVisible (or IsEnabled if you want) property to false under certains
conditions. If you want to do this from code you should give the tabitem an
element name (tabitem.Name or x:Name if doesn't expose this) and access it
from your code-behind.

Kind regards,
Henning Krause

"drewnoakes" <drewnoakes@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:BA7C6F05-5E5B-43AA-87E4-D22DE2030E47@xxxxxxxxxxxxxxxx
> In my application users generally only have one tab page and I'd like > to
> hide
> the tab page buttons (headers?) when this is the case.
>
> I have not been able to find a way to do this. Do I need to re-apply > an
> entire template to the tab control to have a handle into the > appropriate
> object, or can I access the default one?
>
> Also, is there a more appropriate place to discuss WPF issues? I've > been
> trying to use forums.microsoft.com but whenever I try to reply or > create a
> post it logs me out, bizarrely.
>
> Many thanks,
>
> Drew Noakes.


.