Skip to main content

Microsoft Silverlight

Answered Question Using styling inside TabControlRSS Feed

(0)

haagel
haagel

Member

Member

97 points

98 Posts

Using styling inside TabControl

Hi!

I'm having trouble styling a TextBlock that is placed inside a TabControl.

I have created a style in App.xaml:

<Style TargetType="TextBlock" x:Key="InputTextBlock">
    <Setter Property="FontFamily" Value="Verdana" />
    <Setter Property="FontSize" Value="30" />
</Style>

And use the style like this:

<TextBlock Text="Testing" Style="{StaticResource InputTextBlock}"  />

This actually works just fine. The problem occurs when I try to use this style on a TextBlock that is placed inside a TabControl. My xaml is structured like this:

<Grid x:Name="LayoutRoot">
    <TabControl>
        <TabItem>
            <TextBlock>

If I place the TextBlock outside the TabControl it works fine, but as soon as it is in the TabItem it stops working.

 

Does anyone have any ideas what the problem is? 

I'm using Silverlight 2 Beta 2 

SilverlightShow
Silverli...

Participant

Participant

1133 points

193 Posts

Answered Question

Re: Using styling inside TabControl

Hi,

It is a known issue in Silverlight 2 Beta 2. See more here: http://silverlight.net/forums/t/23616.aspx

It will be fixed in the final.

(If this has answered your question, please click on "Mark as Answer" on this post. Thank you!)

Best Regards,
SilverlightShow Team,
www.SilverlightShow.net - news, articles, tips, examples, books

haagel
haagel

Member

Member

97 points

98 Posts

Re: Using styling inside TabControl

Strangely, it works fine when I'm styling a TextBox in the same location... Huh?

SilverlightShow
Silverli...

Participant

Participant

1133 points

193 Posts

Re: Using styling inside TabControl

Hi,

Yes, you can style the TextBox byt set the Properties in xaml. But using Styles gives a problems.

(If this has answered your question, please click on "Mark as Answer" on this post. Thank you!)

Best Regards,
SilverlightShow Team,
www.SilverlightShow.net - news, articles, tips, examples, books

haagel
haagel

Member

Member

97 points

98 Posts

Re: Using styling inside TabControl

No, I'm actually styling it the same way as I try to style the TextBlock. That is, using a style defined in App.xaml (as described above). And it works!

So, it DOES work with TextBox but it DOES NOT work with TextBlock...Huh? 

  • Unanswered Question
  • Answered Question
  • Announcement
Microsoft Communities