title: display multiple data horizontally
body: <p>how to display data horizontally in a list box. I had used the properties for reading data from the text box and i have to display these multiple data in to a list box (in one line, horizontally) . my code is shown below..</p>
  
  <pre><code>private void SaveButton_Click(object sender, RoutedEventArgs e)
      {
          LoadData();
  
  
  
      }
  
  private void LoadData()
      {
          List&lt;ItemList&gt; MyList = new List&lt;ItemList&gt;();
          MyList.Add(new ItemList { Subject = subjectText.Text });
          MyList.Add(new ItemList { Createdtext = CreatedText.Text });
          MyList.Add(new ItemList { Calendartext = CalendarText.Text });
          MyList.Add(new ItemList { TimeText = TimeText.Text });
          MyList.Add(new ItemList { AssignedText = AssignedText.Text });
          MyList.Add(new ItemList { DescriptionText = DescriptText.Text });
          MyList.Add(new ItemList { TargetdateText = TargetDateText.Text });
  
          MyListBox.ItemsSource = MyList;
  
      }
  </code></pre>
  
  <p>The property for getting data is:</p>
  
  <pre><code>public class ItemList
  {
      private string _subject;
      private string _createdtext;
      private string _calendartext;
      private string _timeText;
      private string _assignedText;
      private string _descriptionText;
      private string _targetdateText;
  
  
      public string Subject
      {
          get
          {
              return _subject;
          }
          set
          {
              _subject = value;
          }
      }
  
      public string Createdtext
      {
          get
          {
              return _createdtext;
          }
          set
          {
              _createdtext = value;
          }
      }
  
      public string Calendartext
      {
          get
          {
              return _calendartext;
          }
  
          set
          {
              _calendartext = value;
          }
      }
  
      public string TimeText
      {
          get
          {
              return _timeText;
          }
  
          set
          {
              _timeText = value;
          }
      }
  
      public string AssignedText
      {
          get
          {
              return _assignedText;
          }
  
          set
          {
              _assignedText = value;
          }
      }
  
      public string DescriptionText
      {
          get
          {
              return _descriptionText;
          }
  
          set
          {
              _descriptionText = value;
          }
      }
  
      public string TargetdateText
      {
          get
          {
              return _targetdateText;
          }
  
          set
          {
              _targetdateText = value;
          }
      }
  }
  </code></pre>
  
  <p>My XAML code for List box is shown below</p>
  
  <pre><code>&lt;ListBox x:Name="MyListBox" ItemsSource="ItemList" Grid.ColumnSpan="6" HorizontalAlignment="Left"  Grid.Column="1" Grid.Row="8" Width="600" Height="96"&gt;
          &lt;ListBox.ItemTemplate&gt;
              &lt;DataTemplate&gt;
                  &lt;StackPanel  Orientation="Horizontal" &gt;
                      &lt;Grid ShowGridLines="True" Width="700"&gt;
                          &lt;Grid.ColumnDefinitions&gt;
                              &lt;ColumnDefinition Width="100" /&gt;
                              &lt;ColumnDefinition Width="100" /&gt;
                              &lt;ColumnDefinition Width="100" /&gt;
                              &lt;ColumnDefinition Width="100" /&gt;
                              &lt;ColumnDefinition Width="100" /&gt;
                              &lt;ColumnDefinition Width="100" /&gt;
                              &lt;ColumnDefinition Width="100" /&gt;
                          &lt;/Grid.ColumnDefinitions&gt;
                          &lt;Grid.RowDefinitions&gt;
                              &lt;RowDefinition Height="25" /&gt;
  
                          &lt;/Grid.RowDefinitions&gt;
  
                       &lt;TextBlock Text="{Binding Subject}" Grid.Column="0"/&gt;
                      &lt;TextBlock Text="{Binding Createdtext}"  Grid.Column="1" /&gt;
                      &lt;TextBlock Text="{Binding Calendartext}" Grid.Column="2" /&gt;
                      &lt;TextBlock Text="{Binding Timetext}" Grid.Column="3"/&gt;
                      &lt;TextBlock Text="{Binding AssignedText}"  Grid.Column="4"/&gt;
                      &lt;TextBlock Text="{Binding DescriptionText}"  Grid.Column="5" /&gt;
                      &lt;TextBlock Text="{Binding TargetdateText}"  Grid.Column="6"/&gt;
                      &lt;/Grid&gt;
                  &lt;/StackPanel&gt;
              &lt;/DataTemplate&gt;
          &lt;/ListBox.ItemTemplate&gt;
      &lt;/ListBox&gt;
  &lt;/Grid&gt;
  </code></pre>
  
  <p>but i didn't get the output in one line. it displayed in diagonally.. What are the changes required for getting correct output..</p>