about TabControl personalization  
Author Message
alex_e1z





PostPosted: Visual Studio WPF Designer, about TabControl personalization Top

Hello,
___________________ ______________
/ text1 \ / text2 \
| (also back image) | (also back image) |
---------------------------------------------------------------------
| |
---------------------------------------------------------------------
I need to make a TabControl with picture and text on the tab header. The picture and the text should change on click so the focus tab to be with another picture and the text with another color. The code below does change the bitmap. but i can't figure out how to change the font color. I added the IsHitTestVisible = false to the font because when i was with the mouse on the text, the bitmap changed to grayed one.how to to that


<Window x:Uid="Window_1" x:Class="wifi.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="wifi" Height="596.25" Width="858.5"
xmlns:d="http://schemas.microsoft.com/expression/blend/2006" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d"
>

<Window.Resources>
<Style x:Key="MyHead" TargetType="{x:Type Image}">
<Setter Property="ClipToBounds" Value="False"/>
<Setter Property="Source" Value="Res\settings_normal.bmp"/>
<Setter Property="Stretch" Value="Uniform"/>
<Setter Property="StretchDirection" Value="Both"/>
<Setter Property="Margin" Value="0.059,-2.227,1.559,15.866"/>
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Source" Value="Res\settings_clicked.bmp"/>
</Trigger>
</Style.Triggers>
</Style>

<Style x:Key="MyTab" TargetType="{x:Type TabItem}">
<Setter Property="Padding" Value="-4,-4,-4,-4"/>
<Setter Property="Width" Value="202"/>
<Setter Property="Height" Value="40"/>
<Setter Property="Margin" Value="-2,-11,-2,-14"/>
</Style>

<Style x:Key="MyText" TargetType="{x:Type TextBlock}">
<Setter Property="RenderTransformOrigin" Value="0.494,0.453"/>
<Setter Property="Margin" Value="4,12.8,7,30.3"/>
<Setter Property="Panel.ZIndex" Value="1"/>
<Setter Property="IsHitTestVisible" Value="False"/>
<Setter Property="FontSize" Value="12"/>
<Setter Property="Foreground" Value="#FFFFFFFF"/>
<Setter Property="TextAlignment" Value="Center"/>
<Setter Property="HorizontalAlignment" Value="Center"/>
<Setter Property="Width" Value="133"/>
</Style>

<Style x:Key="TabGrid" TargetType="{x:Type Grid}">
<Setter Property="Width" Value="205.733"/>
<Setter Property="Height" Value="59.363"/>
</Style>

</Window.Resources>
<TabControl Margin="20.5,162.051,28,36.529" Name="tabControl1" Grid.Column="1" >

<TabItem Tag="{x:Null}" Content="Scanning and status" Style="{StaticResource MyTab}">
<TabItem.Header>
<Grid Style="{StaticResource TabGrid}">
<TextBlock Style="{StaticResource MyText}" Text="Scanning &amp; Status" IsEnabled="False"/>
<Image Style="{StaticResource MyHead}"/>
</Grid>
</TabItem.Header>
</TabItem>

<TabItem Tag="{x:Null}" Content="yy" Style="{StaticResource MyTab}">
<TabItem.Header>
<Grid Style="{StaticResource TabGrid}">
<TextBlock Style="{StaticResource MyText}" Text="Favorites Management"/>
<Image Style="{StaticResource MyHead}"/>
</Grid>
</TabItem.Header>
</TabItem>
</TabControl>
</Window>



Visual Studio 20082  
 
 
chadr - msft





PostPosted: Visual Studio WPF Designer, about TabControl personalization Top

Alex,

You might find more expertise in the WPF TabControl from folks in the WPF Forum: http://forums.microsoft.com/MSDN/ShowForum.aspx ForumID=119&SiteID=1. This place is for the VS design-time tools for WPF, namely the design surface in VS.

thanks,
chad