Here's a bit of an expanded example for you.
While you may find a way to concatenate the strings and then space them properly by displaying them in something other than a listview, a listview is going to be your best option.
Your code will look something akin to this:
public partial class MainWindow : Window { //Your data private string date = "2016-04-04"; private string time = "20:20"; private string description = "poop"; //Declare a list public List<object> myList { get; set; } public MainWindow() { InitializeComponent(); DataContext = this; //Instantiate your list myList = new List<object>(); //Make a new object var listObject = new { newDate = date, newTime = time, newDescription = description }; //Add that object to your list myList.Add(listObject); } }
And your XAML to display your results:
<Window x:Class="WpfApplicationTestApp.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="MainWindow" Height="350" Width="525"> <Grid> <ListView x:Name="listView" ItemsSource="{Binding myList}"> <ListView.View> <GridView> <GridViewColumn Header="Date" DisplayMemberBinding="{Binding newDate}"/> <GridViewColumn Header="Time" DisplayMemberBinding="{Binding newTime}"/> <GridViewColumn Header="Description" DisplayMemberBinding="{Binding newDescription}"/> </GridView> </ListView.View> </ListView> </Grid> </Window>
TextBoxcontrol? AListViewwith 3 columns might be better and easier to format.taskis a single string. But if you have three separate values and want to display them in column/tabular format, then it would make more sense to create an object containing those three values and bind aListVieworGridViewor something like that to a collection of those objects.