1

我对网格布局的背景图像有一个奇怪的问题。由于某种原因,ListPicker 没有完全覆盖图像。相反,应用了一些不透明度......(查看图片中的齿轮图标)

带不透明度问题的网格背景

 <Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
        <Grid>
            <Grid.Background>
                <ImageBrush 
                        ImageSource="/BrewingApp;component/Images/icon_gears_big.png" 
                        AlignmentX="Right" 
                        AlignmentY="Bottom" 
                        Stretch="None" 
                        Opacity="0.5" />
            </Grid.Background>
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="1*"/>
            </Grid.RowDefinitions>
...
                <StackPanel
                Grid.Row="1"
                Margin="0,12,0,0">
                <TextBlock Text="More Stuff :-)"></TextBlock>
                <Rectangle
                        Grid.Row="1"
                        HorizontalAlignment="Stretch"
                        VerticalAlignment="Top"
                        Height="1" 
                        Stroke="Red" 
                        StrokeThickness="1" >
                </Rectangle>

                <toolkit:ListPicker
                    Header="Hop Formula"
                    ItemsSource="{Binding HopFormulaList}"
                    SelectedItem="{Binding HopFormulaSelection, Mode=TwoWay}"
                    HorizontalAlignment="Stretch" OpacityMask="Blue" />

            </StackPanel>

        </Grid>

谢谢!

4

1 回答 1

1

TextBoxListPicker使用PhoneTextBoxBrush他们的背景。此笔刷使用颜色#BFFFFFFF。即,具有一点透明度 (BF) 的白色 (FFFFFF)。因此你的问题。解决问题的一种方法是简单地更改这些控件的背景:

<Grid.Resources>
    <SolidColorBrush x:Key="PhoneTextBoxBrush" Color="#BEBEBE"/>
    <Style TargetType="toolkit:ListPicker">
        <Setter Property="Background" Value="{StaticResource PhoneTextBoxBrush}" />
    </Style>
    <Style TargetType="TextBox">
        <Setter Property="Background" Value="{StaticResource PhoneTextBoxBrush}" />
    </Style>
</Grid.Resources>
于 2012-10-26T18:00:23.353 回答