0
請幫忙弄清楚這個奇怪的白色輪廓TextBlock
是怎麼出現的。TextBlock有奇怪的白色輪廓
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);
確實。如果您沒有使用ListBox的選擇功能,您可能需要查看ItemsControl/ScrollViewer + StackPanel組合。 – Robaticus 2012-02-16 19:37:56
@Robaticus謝謝你!這真的是很好的建議!我只是用ItemsControl替換了ListBox,一切都很好!涼! – 2012-02-16 19:48:56