如果在数据库中 存了一个数据为
123
456
那么 如何在ListBox显示出来的时候为 123456 在一行显示
模型里新增一个字段
public string name {get;set; }
public string tempName => this.name.Replace("\r\n", "");
<TextBlock Text="{Binding tempName,Mode=OneWay}" FontSize="13" Margin="3,0,0,0" Foreground="#FF3887FB" VerticalAlignment="Center"></TextBlock>
把换行符替换掉不就可以了吗? 取出字符串 然后替换 Replace("\r", "").Replace("\n", "");