0

Windows Phone 7でスクロールバーの色を変更するにはどうすればよいですか、またWindows Phone 7でスクロールバーをカスタマイズしたいのですが、教えてください。

4

2 に答える 2

0

XAML へのコーディングに満足している場合は、ここで答えを見つけてください。または、最短で最も簡単な方法は、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>

これがすべてあなたに役立つことを願っています:)

于 2013-05-10T18:42:08.763 に答える