WPF - StackPanel将内容隐藏到左侧

时间:2018-03-05 20:25:40

标签: c# wpf xaml stackpanel

我正在尝试在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”的东西

1 个答案:

答案 0 :(得分: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