2017-02-24 126 views
1

我需要自定義由Scrollview.horizo​​ntalscrollbarvisibility創建的滾動條。目前滾動條非常薄,不像標準滾動條。我試着改變scrollview的樣式,但沒有屬性來設置高度/寬度/顏色。XAML在ListView中定製滾動條(UWP)

<Grid x:Name="Playlist" 
     Visibility="{Binding IsShow}" 
     Width="960" > 
     <ListView x:Name="listview" 
        ScrollViewer.HorizontalScrollBarVisibility="Auto" 
        ScrollViewer.IsHorizontalRailEnabled="True" 
        ItemsSource="{Binding Path=YourCollection}" 
        GotFocus="StackPanel_GotFocus" 
        IsItemClickEnabled="True" 
        ItemClick="ListView_ItemClick" 
        Margin="125,198,125,19"> 
      <ListView.ItemsPanel> 
       <ItemsPanelTemplate> 
        <StackPanel Orientation="Horizontal" 
           Height="200"/> 
       </ItemsPanelTemplate> 
      </ListView.ItemsPanel> 
      <ListView.ItemTemplate> 
       <DataTemplate> 
        <StackPanel Orientation="Vertical" 
           Height="200" 
           Width="256"> 
         <StackPanel Orientation="Horizontal"> 
          <Image Source="{Binding Image}" 
            Height="144" 
            Width="256" 
            HorizontalAlignment="Stretch" 
            VerticalAlignment="Top"/> 
         </StackPanel> 
         <StackPanel Orientation="Horizontal"> 
          <TextBlock Text="{Binding Title}" 
             Height="56" 
             Width="256" 
             HorizontalAlignment="Stretch" 
             VerticalAlignment="Bottom"/> 
         </StackPanel> 
        </StackPanel> 
       </DataTemplate> 
      </ListView.ItemTemplate> 
     </ListView> 
    </Grid> 

回答

1

您可以通過修改ControlTemplate來做到這一點。這樣做會花費你很多時間。 This可能會幫助你。