Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Override ScrollViewer size
Message
De
09/04/2009 09:41:57
 
 
À
Tous
Information générale
Forum:
ASP.NET
Catégorie:
Windows Presentation Foundation (WPF)
Titre:
Override ScrollViewer size
Versions des environnements
Environment:
C# 3.0
Divers
Thread ID:
01393942
Message ID:
01393942
Vues:
115
Hi,
This should be simple but it's beating me. Here's a simple XAML window:
<Window x:Class="WpfApplication1.Window23"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      Title="ScrollViewer Test">
    <StackPanel >
        <ScrollViewer  HorizontalScrollBarVisibility="Auto">
            <Rectangle Width="500" Height="500" Fill="Red" />
        </ScrollViewer>
    </StackPanel>
</Window>
When I run this and make the window narrower then the horizontal scrollbar kicks in when required. If, however, I reduce the height of the window then the minimum height of the StackPanel (and ScrollViewer) is constrained by the height of the Rectangle (if I switch the Orientation of the StackPanel I get the opposite behaviour (i.e vertical Scrollbar works) )

I assume the solution to this may be to override Measure/Arrange somewhere - or maybe to wrap the ScrollViewer in something other than a StackPanel - but can't seem to find anything that will work :-{

UPDATE: Ha, DockPanel works. But it would be good to find a solution when using StackPanel.....
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform