1

想象一下我有这个刷子:

<SolidColorBrush x:Key="MySolidDarkBackground" Color="{DynamicResource DarkBackgroundColorTop}" />

如何将此画笔用于滚动查看器背景但具有不同的不透明度?

<ScrollViewer VerticalScrollBarVisibility="Auto" Grid.Row="1">
            <ScrollViewer.Background>
                < ??? >
            </ScrollViewer.Background>
</ScrollViewer>
4

1 回答 1

1

您要么必须创建第二个 Brush 资源并使用它:

<SolidColorBrush x:Key="MyTransparentDarkBackground" Opacity="0.5" Color="{DynamicResource DarkBackgroundColorTop}" />
<ScrollViewer Background="{DynamicResource MyTransparentDarkBackground}" />

或者你可以重用动态颜色资源:

<ScrollViewer>
  <ScrollViewer.Background>
    <SolidColorBrush Opacity="0.5" Color="{DynamicResource DarkBackgroundColorTop}" />
  </ScrollViewer.Background>
</ScrollViewer>
于 2012-05-30T10:09:49.643 回答