关于模糊TextBlock的明文?

时间:2012-10-08 19:10:18

标签: c# windows-8 microsoft-metro opacity textblock

我有我的地铁应用程序的xaml代码。

    <Grid Width="531" Height="531">
        <Grid.Background>
            <ImageBrush ImageSource="{Binding image1}" Stretch="UniformToFill"  />
        </Grid.Background>
        <StackPanel Background="#0072B0" Opacity="0.7" VerticalAlignment="Bottom">
            <Border BorderThickness="0,0,0,1" BorderBrush="White">
                <TextBlock Text="{Binding name}" VerticalAlignment="Bottom" Opacity="1"  Style="{StaticResource BigTopDealItemTitle}"/>
            </Border>
        </StackPanel>
    </Grid>

我想制作一个模糊面板并在上面打开文字。但看起来TextBlock中的文字也模糊了,即使我用1设置它的不透明度。

1 个答案:

答案 0 :(得分:1)

要使背景模糊而不使文本框模糊,请执行以下操作:

<Grid Width="531" Height="531">
    <Grid.Background>
        <ImageBrush ImageSource="{Binding image1}" Stretch="UniformToFill"  />
    </Grid.Background>
    <StackPanel Background="#0072B0" Opacity="0.7" VerticalAlignment="Bottom">
        <Grid>
            <Border BorderThickness="0,0,0,1" BorderBrush="White"/>
            <TextBlock Text="{Binding name}" VerticalAlignment="Bottom" Style="{StaticResource BigTopDealItemTitle}"/>
        </Grid>
    </StackPanel>
</Grid>

这会将TextBlock置于背景之上(即Border),而不受Border属性的影响。