WPF - StackPanel将内容隐藏到左侧

问题描述 投票:1回答:1

我正在尝试在StackPanel中插入一个按钮列表但是我想隐藏包装内容而不是正确,因为它正在进行中

enter image description here

这是我的代码xaml

<StackPanel Orientation="Horizontal" >
    <Button Width="50">1.5678</Button>
    <Button Width="50">1.5678</Button>
    <Button Width="50">1.5678</Button>
    <Button Width="50">1.5678</Button>
    <Button Width="50">1.5678</Button>
    <Button Width="50">1.5678</Button>
    <Button Width="50">1.5678</Button>
    <TextBox x:Name="EDT_NUMERO_CFOP" Style="{StaticResource TextBoxNoBorder}" Height="30"></TextBox>
</StackPanel>

我认为有类似“hideToLeft”的东西

c# wpf xaml stackpanel
1个回答
1
投票

使用FlowDirection属性= RightToLeft将StackPanel包装在ScrollViewer中

   <ScrollViewer CanContentScroll="True" FlowDirection="RightToLeft">
    <StackPanel Orientation="Horizontal" Margin="0,0,6,6.5" >
        <Button Width="50">1.5678</Button>
        <Button Width="50">1.5678</Button>
        <Button Width="50">1.5678</Button>
        <Button Width="50">1.5678</Button>
        <Button Width="50">1.5678</Button>
        <Button Width="50">1.5678</Button>
        <Button Width="50">1.5678</Button>
        <TextBox x:Name="EDT_NUMERO_CFOP" Style="{StaticResource TextBoxNoBorder}"  Height="30"></TextBox>
    </StackPanel>
</ScrollViewer>

flow from right to left

© www.soinside.com 2019 - 2024. All rights reserved.