【问题标题】:Clear text on bluring TextBlock?模糊TextBlock上的清晰文本?
【发布时间】:2012-10-09 03:16:10
【问题描述】:

我的 Metro 应用程序有这个 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。

【问题讨论】:

  • 这是 wpf 还是 Metro?不能两者兼有。
  • 是地铁。我是在标题上写的:D
  • 但是你把 wpf 放在标签里。 Wpf 与地铁不兼容。我修好了。
  • 哦,对不起XD我是新手
  • 没问题,只是想确保您的问题被正确标记。

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


【解决方案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 属性的影响。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-02-09
    • 2020-10-27
    • 1970-01-01
    • 2020-11-17
    • 1970-01-01
    • 2019-06-29
    相关资源
    最近更新 更多