ScrollViewer / TextBlock bug?
Posted: 19 Aug 2013, 01:21
I'm prototyping a general dialog with the following XAML:
And style:
In Kaxaml this displays correctly. But in Unity, the contents of the TextBlock that overflows the height of the ScrollViewer isn't hidden, it's displayed outside the ScrollViewer.
Code: Select all
<!-- Dialog -->
<Border Name="dialogBrdr" Style="{StaticResource DialogBorder}">
<StackPanel Name="dialogPnl" Style="{StaticResource DialogPanel}">
<Label Name="dialogLbl" Style="{StaticResource DialogLabel}">Dialog title</Label>
<Rectangle Style="{StaticResource DialogRectangle}" />
<ScrollViewer Name="dialogScrlViwr" Style="{StaticResource DialogScrollViewer}">
<TextBlock Name="dialogCnt" Style="{StaticResource DialogContent}">TextTextTextTextTe xtTextTextTextTextTextTextT extTextTextTextTextText TextTextTextTextTextTextText TextTextTextTextTextTex tTextTextTextText TextTextTextTextTe xtTextTextTextTextTextTextT extTextTextTextTextText TextTextTextTextTextTextText TextTextTextTextTextTex tTextTextTextText TextTextTextTextTe xtTextTextTextTextTextTextT extTextTextTextTextText TextTextTextTextTextTextText TextTextTextTextTextTex tTextTextTextText TextTextTextTextTe xtTextTextTextTextTextTextT extTextTextTextTextText TextTextTextTextTextTextText TextTextTextTextTextTex tTextTextTextText TextTextTextTextTe xtTextTextTextTextTextTextT extTextTextTextTextText TextTextTextTextTextTextText TextTextTextTextTextTex tTextTextTextText</TextBlock>
</ScrollViewer>
<Rectangle Style="{StaticResource DialogRectangle}" />
<StackPanel Orientation="Horizontal">
<Button Name="dialogBtnOk" Style="{StaticResource DialogButtonOk}">Ok</Button>
<Button Name="dialogBtnCancel" Style="{StaticResource DialogButtonCancel}">Cancel</Button>
</StackPanel>
</StackPanel>
</Border>
Code: Select all
<!-- Dialog -->
<Style x:Key="DialogBorder" TargetType="{x:Type Border}">
<Setter Property="BorderBrush" Value="#60000000" />
<Setter Property="CornerRadius" Value="5" />
<Setter Property="BorderThickness" Value="10" />
<Setter Property="HorizontalAlignment" Value="Center" />
<Setter Property="VerticalAlignment" Value="Center" />
</Style>
<Style x:Key="DialogPanel" TargetType="{x:Type StackPanel}">
<Setter Property="Background" Value="#80000000" />
</Style>
<Style x:Key="DialogLabel" TargetType="{x:Type Label}">
<Setter Property="FontSize" Value="20" />
<Setter Property="Foreground" Value="White" />
<Setter Property="Padding" Value="10" />
</Style>
<Style x:Key="DialogScrollViewer" TargetType="{x:Type ScrollViewer}">
<Setter Property="HorizontalScrollBarVisibility" Value="Auto" />
<Setter Property="VerticalScrollBarVisibility" Value="Auto" />
<Setter Property="Margin" Value="10" />
<Setter Property="Background" Value="Green" />
<Setter Property="Height" Value="100" />
</Style>
<Style x:Key="DialogContent" TargetType="{x:Type TextBlock}">
<Setter Property="FontSize" Value="14" />
<Setter Property="Foreground" Value="White" />
<Setter Property="TextWrapping" Value="Wrap" />
<Setter Property="Width" Value="600" />
</Style>
<Style x:Key="DialogButtonOk" TargetType="{x:Type Button}">
<Setter Property="Padding" Value="10" />
<Setter Property="Margin" Value="10" />
<Setter Property="FontSize" Value="16" />
<Setter Property="Foreground" Value="White" />
</Style>
<Style x:Key="DialogButtonCancel" TargetType="{x:Type Button}">
<Setter Property="Padding" Value="10" />
<Setter Property="Margin" Value="0 10" />
<Setter Property="FontSize" Value="16" />
<Setter Property="Foreground" Value="White" />
</Style>
<Style x:Key="DialogRectangle" TargetType="{x:Type Rectangle}">
<Setter Property="HorizontalAlignment" Value="Stretch" />
<Setter Property="Height" Value="2" />
<Setter Property="Fill" Value="#40FFFFFF" />
<Setter Property="Margin" Value="10 0" />
</Style>