如何实现仅增长的ScrollViewer

时间:2019-06-14 19:21:27

标签: c# wpf

我想要一个堆栈面板,该面板将在达到最小窗口大小后滚动,但在窗口水平增长时会扩展。

如果我将堆栈面板放到一个窗口中并锚定它,但我无法滚动,则可以使增长功能正常工作。

如果我使用scrollViewer,则会得到滚动条,但是堆栈面板永远不会水平增长。

基本上,我需要一个等效于WinForms AutoSizeMode GrowOnly

<Window
         xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
         xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
         xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
         xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
         xmlns:views="clr-namespace:Miner.Responder.Explorer.IncidentReview.Views"
         x:Class="Miner.Responder.Explorer.IncidentReview.Views.IncidentReviewForm"
         mc:Ignorable="d" Height="1069.2" Width="1096">
<ScrollViewer Margin="0,0,2,1" VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto">
    <StackPanel Height="1018" Width="1080" RenderTransformOrigin="0.5,0.5">
        <StackPanel.RenderTransform>
            <TransformGroup>
                <ScaleTransform/>
                <SkewTransform AngleX="0.057"/>
                <RotateTransform/>
                <TranslateTransform X="0.499"/>
            </TransformGroup>
        </StackPanel.RenderTransform>
        <views:IncidentReviewView x:Name="ucIncident" Height="532" Margin="38,0" Width="Auto"/>
        <views:TimeEditor x:Name="ucTimes" Height="166" Margin="38,0" Width="Auto"/>
        <views:HistoryTables x:Name="ucHistory" Height="287"/>
        <Grid Height="30">
            <Button x:Name="BtnOk" Content="OK" Margin="0,0,6,2" RenderTransformOrigin="-0.36,0.558" VerticalAlignment="Bottom" HorizontalAlignment="Right" Width="75" />
            <Button x:Name="BtnCancel" Content="Cancel" HorizontalAlignment="Right" Margin="0,0,166,2" VerticalAlignment="Bottom" Width="76" IsCancel="True" IsDefault="True"/>
            <Button x:Name="BtnSave" Content="Save" HorizontalAlignment="Right" Margin="0,0,86,2" VerticalAlignment="Bottom" Width="75"/>
        </Grid>
    </StackPanel>
</ScrollViewer>

0 个答案:

没有答案