TextBlock有奇怪的白色轮廓

时间:2012-02-16 19:27:04

标签: wpf xaml textblock

请帮助弄清楚TextBlock这个奇怪的白色轮廓是如何出现的。

enter image description here

XAML

<StackPanel Grid.ColumnSpan="2" Grid.Row="1" Grid.RowSpan="2"  >
   <local:Marquee x:Name="marquee1"   Height="100" Width="800" Margin="0,0,0,0">
                <ListBox Name="lstItems"  ItemsPanel="{StaticResource ItemsPanelTemplate1}"   VerticalAlignment="Center" Background="{x:Null}" >                  
                 </ListBox>
   </local:Marquee>            
</StackPanel>

C#

TextBlock tb = new TextBlock();

tb.IsEnabled = false;
tb.Text = Text;
tb.FontWeight = FontWeights.Normal;
tb.Foreground = color;
tb.FontSize = marquee1.Height / koeff;
tb.TextWrapping = TextWrapping.Wrap;
if (!string.IsNullOrEmpty(fFamily))
tb.FontFamily = new FontFamily(fFamily);
if (bColor != null)
{
if (bColor != Brushes.Transparent)
tb.Background = bColor;
}
lstItems.Items.Add(tb);

1 个答案:

答案 0 :(得分:2)

我不认为它属于TextBlock,除非你有一个添加它的样式,它似乎更有可能属于包含它的ListBox