2013-05-10 88 views

回答

0

Have您嘗試使用在你的XAML代碼「背景屬性在滾動條位於

試試這個:

<ScrollBar Background="Green" HorizontalAlignment="Left" Margin="299,144,0,0" VerticalAlignment="Top"/> 

不要用這件事我要你把從它你應該有一行類似於此的xaml代碼就像我一樣輸入背景屬性,希望這一點更清楚。

+0

感謝您的回覆,其實它不工作。我有堆棧面板和文本塊的內容也滾動查看器我的代碼是 – siva 2013-05-10 06:27:39

+0

我已經把它的示例代碼在滾動查看器的堆棧面板的內部,有沒有另一種方式來執行?請告訴我 – siva 2013-05-10 06:31:36

+0

我編輯了我的評論希望有助於更好一點 – 2013-05-10 07:01:45

0

如果您很高興將它編碼到XAML中,請找到您的答案here。或者最簡單的方法是使用Expression Blend

另外一個片段,我發現其他地方:

<ListBox x:Name="myListBox"> 
<ControlTemplate TargetType="ScrollViewer"> 
    <Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}"> 
     <VisualStateManager.VisualStateGroups> 
      <VisualStateGroup x:Name="ScrollStates"> 
       <VisualStateGroup.Transitions> 
        <VisualTransition GeneratedDuration="00:00:00.5"/> 
       </VisualStateGroup.Transitions> 
       <VisualState x:Name="Scrolling"> 
        <Storyboard> 
         <DoubleAnimation Duration="0" To="1" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="VerticalScrollBar"/> 
         <DoubleAnimation Duration="0" To="1" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="HorizontalScrollBar"/> 
        </Storyboard> 
       </VisualState> 
       <VisualState x:Name="NotScrolling"/> 
      </VisualStateGroup> 
     </VisualStateManager.VisualStateGroups> 
     <Grid Margin="{TemplateBinding Padding}"> 
      <ScrollContentPresenter x:Name="ScrollContentPresenter" ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Content}"/> 
      <ScrollBar x:Name="VerticalScrollBar" Background="Blue" HorizontalAlignment="Right" Height="Auto" IsHitTestVisible="False" IsTabStop="False" Maximum="{TemplateBinding ScrollableHeight}" Minimum="0" Opacity="0" Orientation="Vertical" Visibility="{TemplateBinding ComputedVerticalScrollBarVisibility}" Value="{TemplateBinding VerticalOffset}" ViewportSize="{TemplateBinding ViewportHeight}" VerticalAlignment="Stretch" Width="5"/> 
      <ScrollBar x:Name="HorizontalScrollBar" Background="Blue" HorizontalAlignment="Stretch" Height="5" IsHitTestVisible="False" IsTabStop="False" Maximum="{TemplateBinding ScrollableWidth}" Minimum="0" Opacity="0" Orientation="Horizontal" Visibility="{TemplateBinding ComputedHorizontalScrollBarVisibility}" Value="{TemplateBinding HorizontalOffset}" ViewportSize="{TemplateBinding ViewportWidth}" VerticalAlignment="Bottom" Width="Auto"/> 
     </Grid> 
    </Border> 
</ControlTemplate> 

希望這一切都有助於你:)

+0

這是否幫助隊友? – 2013-05-13 17:50:28