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
@Robaticusありがとうございました!それは本当に良い提案でした!私はListBoxをItemsControlに置き換えただけです。クール! –