Page view counter
RCO TabControl style no longer works ...
Last post 10-13-2008 8:02 AM by syl. 1 replies.
Sort Posts:
10-09-2008 5:01 PM
RCO TabControl style no longer works ...

Hi all,

I am trying to migrate my SL2 Beta2 app into RC0

I have made all Breaking Changes

My last issue is a style that hides my TabControl but there no reason ...

In Beta2 this style was working fine

I try to remove some parts, I can't understand why the style is incorrect.

Here is the xaml code :

<Style x:Key="ScrollViewerStyle1" TargetType="ScrollViewer">

<Setter Property="IsEnabled" Value="true"/>

<Setter Property="Foreground" Value="#FF000000"/>

<Setter Property="BorderBrush" Value="#FFA4A4A4"/>

<Setter Property="BorderThickness" Value="1"/>

<Setter Property="HorizontalContentAlignment" Value="Left"/>

<Setter Property="VerticalContentAlignment" Value="Top"/>

<Setter Property="Cursor" Value="Arrow"/>

<!--RCO Changement-->

<!--<Setter Property="TextAlignment" Value="Left"/>

<Setter Property="TextWrapping" Value="NoWrap"/>-->

<!--<Setter Property="FontSize" Value="11"/>-->

<Setter Property="VerticalScrollBarVisibility" Value="Visible"/>

<Setter Property="Template">

<Setter.Value>

<ControlTemplate TargetType="ScrollViewer">

<Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="1">

<Grid Background="{TemplateBinding Background}">

<Grid.ColumnDefinitions>

<ColumnDefinition Width="*"/>

<ColumnDefinition Width="Auto"/>

</Grid.ColumnDefinitions>

<Grid.RowDefinitions>

<RowDefinition Height="*"/>

<RowDefinition Height="Auto"/>

</Grid.RowDefinitions>

<Rectangle Grid.Column="1" Grid.Row="1" Fill="{StaticResource GradientFooter}"/>

<!--<ScrollContentPresenter Cursor="{TemplateBinding Cursor}" Margin="{TemplateBinding Padding}" x:Name="ScrollContentPresenter" Background="{TemplateBinding Background}" HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}" Grid.Column="0" Grid.Row="0" Content="{TemplateBinding Content}" ContentTemplate="{TemplateBinding ContentTemplate}" TextAlignment="{TemplateBinding TextAlignment}" TextDecorations="{TemplateBinding TextDecorations}" TextWrapping="{TemplateBinding TextWrapping}"/>--><!--RCO Changement-->

<ScrollContentPresenter Cursor="{TemplateBinding Cursor}" Margin="{TemplateBinding Padding}" x:Name="ScrollContentPresenter" Grid.Column="0" Grid.Row="0" Content="{TemplateBinding Content}" ContentTemplate="{TemplateBinding ContentTemplate}" />

<ScrollBar Cursor="Arrow" x:Name="VerticalScrollBar" Width="18" Visibility="{TemplateBinding ComputedVerticalScrollBarVisibility}" Grid.Column="1" Grid.Row="0" Orientation="Vertical" ViewportSize="{TemplateBinding ViewportHeight}" Maximum="{TemplateBinding ScrollableHeight}" Minimum="0" Value="{TemplateBinding VerticalOffset}" d:IsHidden="True"/>

<ScrollBar Cursor="Arrow" Height="9" x:Name="HorizontalScrollBar" Visibility="{TemplateBinding ComputedHorizontalScrollBarVisibility}" Grid.Column="0" Grid.Row="1" Orientation="Horizontal" ViewportSize="{TemplateBinding ViewportWidth}" Maximum="{TemplateBinding ScrollableWidth}" Minimum="0" Value="{TemplateBinding HorizontalOffset}" Style="{StaticResource ScrollBarStyle1}"/>

</Grid>

</Border>

</ControlTemplate>

</Setter.Value>

</Setter>

</Style>

<Style x:Key="MyTabControlStyle" TargetType="controls:TabControl">

<Setter Property="Template">

<Setter.Value>

<ControlTemplate>

<Grid x:Name="TabControlRoot">

<StackPanel Orientation="Vertical">

<ScrollViewer x:Name="scrollHeader" Canvas.ZIndex="1" Width="207" HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Disabled" Grid.Column="0" Grid.Row="0" BorderBrush="#FFFBFBFB" BorderThickness="0,0,0,0" Style="{StaticResource ScrollViewerStyle1}">

<primitives:TabPanel x:Name="TabPanel" HorizontalAlignment="Left" VerticalAlignment="Top" />

</ScrollViewer>

<Border x:Name="TabControlContentBorder" Background="{TemplateBinding Background}" Grid.Column="0" Grid.Row="1">

<ContentControl x:Name="ContentHost"

Width="208"

Foreground="{TemplateBinding Foreground}"

FontSize="{TemplateBinding FontSize}"

FontFamily="{TemplateBinding FontFamily}"

HorizontalAlignment="{TemplateBinding HorizontalAlignment}"

VerticalAlignment="{TemplateBinding VerticalAlignment}"

Margin="0,0,0,0" />

</Border>

</StackPanel>

</Grid>

</ControlTemplate>

</Setter.Value>

</Setter>

<Setter Property="Background" Value="#FFA6A4A4"/>

</Style>

 

Where is the problem in the style ?

Thx for your replies :-)

 

--
Best regards

Belmessieri Sylvain (Alti)

syl

Loading...
Joined on 05-26-2007
Paris
Posts 24
10-13-2008 8:02 AM
Marked as Answer
Re: RCO TabControl style no longer works ...

Hi all

I've found the solution

If I use the style defined in App.xaml with a reference to System.Windows.Controls in the TargetType

ex : <Style x:Key="MyTabControlStyle" TargetType="controls:TabControl">

With a refrence to the dll like that :

xmlns:Controls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls"

The TabControl does'nt appear.

If I set the control template directly in the TabControl like this :

<Controls:TabControl x:Name="tabControl" Width="208" Margin="0,18.331,0,0.004" VerticalAlignment="Stretch" Background="#FFFFFFFF" MinWidth="0" MinHeight="0" UseLayoutRounding="True">

<Controls:TabControl.Resources>

<ControlTemplate x:Key="MyTabControlTemplate">

<Grid x:Name="TabControlRoot">

<StackPanel Orientation="Vertical" Background="#FFA6A4A4">

<ScrollViewer x:Name="scrollHeader" Canvas.ZIndex="1" Width="207" HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Disabled" Grid.Column="0" Grid.Row="0" BorderBrush="#FFFBFBFB" BorderThickness="0,0,0,0" Style="{StaticResource ScrollViewerStyle1}">

<primitives:TabPanel x:Name="TabPanel" HorizontalAlignment="Left" VerticalAlignment="Top" />

</ScrollViewer>

<Border x:Name="TabControlContentBorder" Background="{TemplateBinding Background}" BorderThickness="0,0,0,0" Grid.Column="0" Grid.Row="1">

<ContentControl x:Name="ContentHost"

Width="208"

Foreground="{TemplateBinding Foreground}"

FontSize="{TemplateBinding FontSize}"

FontFamily="{TemplateBinding FontFamily}"

HorizontalAlignment="{TemplateBinding HorizontalAlignment}"

VerticalAlignment="{TemplateBinding VerticalAlignment}"

Margin="0,0,0,0" />

</Border>

</StackPanel>

</Grid>

</ControlTemplate>

 .......

It works fine :-)

This post is on the same suggest and is usefull

http://silverlight.net/forums/t/31597.aspx

 

--
Best regards

Belmessieri Sylvain (Alti)

syl

Loading...
Joined on 05-26-2007
Paris
Posts 24
Microsoft Communities