1
我有一個ListView
我收到了一些類似於發佈便箋的東西。UWP ListView填充和ScrollView高度
我已經設置了所有ListView
元素都有padding="0,0,0,-170"
,所以我可以將一個註釋疊加到另一個上面,以便能夠看到他們的標題(標題)並且還能夠看到最後一個註釋。它工作的很好,但唯一的問題是,當我將更多的筆記疊加到另一個筆記上時,我來到ListView
的筆記底部(底部是指低於標題的底部)。
這個想法只是爲了讓它可以進一步滾動(像添加170px,我已經填充),但我不知道如何更改滾動高度。我打開任何想法,也許有一些解決方法。
下面的代碼:
<ListView.ItemContainerStyle>
<Style TargetType="ListViewItem">
<Setter Property="Padding" Value="0,0,0,-170"/>
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="MinHeight" Value="20" />
</Style>
</ListView.ItemContainerStyle>
<ListView.ItemTemplate>
<DataTemplate x:DataType="data:Note">
<StackPanel Height="202" Width="200" Margin="10,0,10,0" BorderThickness="2" BorderBrush="#FF320000" RenderTransformOrigin="0.5,0.5">
<StackPanel.Background>
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
<GradientStop Color="#FF935920" Offset="0"/>
<GradientStop Color="#FFC59564" Offset="1"/>
</LinearGradientBrush>
</StackPanel.Background>
<TextBlock Name="header" Text="{Binding header}" Margin="5,5,5,5" Height="30" TextWrapping="NoWrap" HorizontalAlignment="Center" FontSize="20" FontWeight="ExtraBold" Foreground="#FFD6B900" RelativePanel.AlignTopWithPanel="True" RelativePanel.AlignLeftWithPanel="True" RelativePanel.AlignRightWithPanel="True"/>
<TextBlock Name="content" Text="{Binding content}" Margin="5,0,5,5" Height="135" TextWrapping="Wrap" FontSize="16" FontStyle="Italic" RelativePanel.AlignLeftWithPanel="True" RelativePanel.AlignRightWithPanel="True" RelativePanel.Below="header"/>
<TextBlock Name="date" Text="{Binding date, Converter={StaticResource DateToStringFormatConverter}}" Margin="5,0,5,0" Height="20" TextWrapping="NoWrap" VerticalAlignment="Bottom" Foreground="Black" RelativePanel.AlignBottomWithPanel="True" RelativePanel.AlignRightWithPanel="True" HorizontalAlignment="Right"/>
</StackPanel>
</DataTemplate>
</ListView.ItemTemplate>
下面是它的樣子: