none
textblock的文字间距设置 RRS feed

答案

  • 你好。

    可以采用ItemsControl的方式来实现:

            <ItemsControl ItemsSource="{Binding}" x:Name="itemsControl">
                <ItemsControl.ItemsPanel>
                    <ItemsPanelTemplate>
                        <StackPanel Orientation="Horizontal"/>
                    </ItemsPanelTemplate>
                </ItemsControl.ItemsPanel>
                <ItemsControl.ItemTemplate>
                    <DataTemplate>
                        <Border Margin="5">
                            <ContentPresenter Content="{Binding}"/>
                        </Border>
                    </DataTemplate>
                </ItemsControl.ItemTemplate>
            </ItemsControl>

    后台代码去绑定数据:

    itemsControl.ItemsSource = "hello world";
    根据需要去修改Margin的值就可以了。


    希望我的答案能帮助更多的人。

    2014年11月19日 8:53