title: How to assign List<> Object values to textBox (s)
body: <p>I want to assign the values of the findFamily object to the different TextBox(s) i tried the following code but it's not working would you please suggest me a better way. Thanks in advance.</p>
  
  <pre><code> private void Search_Click(object sender, RoutedEventArgs e)
      {
          if (SearchFamilyMemberId.Text.Trim() != "")
          {
              SITDataDataContext con = new SITDataDataContext();
              List&lt;Family&gt; findFamily = (from s in con.Families where s.FamilyMemberId.Equals(SearchFamilyMemberId.Text.Trim()) select s).ToList();
              if (findFamily.Any())
              {
                  FamilyMemberId.Text = findFamily[0];
                  FirstName.Text = findFamily[1];
                  LastName.Text = findFamily[2];
                  if (findFamily[3]=="Male")
                  {
                      Male.IsChecked = true;
                  }
                  else
                  {
                      Female.IsChecked = true;
                  }
                  Phone.Text = findFamily[4];
                  Address.Text = findFamily[5];
  
              }
              else
              {
                  MessageBox.Show("Family Id not found!");
              }
          }
          else
          {
              MessageBox.Show("Invalid Id!");
          }
      }
  </code></pre>
  
  <p>here is my xamal code</p>
  
  <pre><code> &lt;Grid Margin="10"&gt;
          &lt;Grid.RowDefinitions&gt;
              &lt;RowDefinition Height="Auto"/&gt;
              &lt;RowDefinition Height="Auto"/&gt;
              &lt;RowDefinition Height="Auto"/&gt;
              &lt;RowDefinition Height="Auto"/&gt;
              &lt;RowDefinition Height="Auto"/&gt;
              &lt;RowDefinition Height="Auto"/&gt;
              &lt;RowDefinition Height="*"/&gt;
              &lt;RowDefinition Height="Auto"/&gt;
          &lt;/Grid.RowDefinitions&gt;
          &lt;Grid.ColumnDefinitions&gt;
              &lt;ColumnDefinition Width="*"/&gt;
              &lt;ColumnDefinition Width="*"/&gt;
              &lt;ColumnDefinition Width="*"/&gt;
          &lt;/Grid.ColumnDefinitions&gt;
          &lt;Label Grid.Row="1" Grid.Column="0" Content="Family Member ID:"/&gt;
          &lt;Label Grid.Row="2" Grid.Column="0" Content="First Name:"/&gt;
          &lt;Label Grid.Row="3" Grid.Column="0" Content="Last Name:"/&gt;
          &lt;Label Grid.Row="4" Grid.Column="0" Content="Gender:"/&gt;
          &lt;Label Grid.Row="5" Grid.Column="0" Content="Phone:"/&gt;
          &lt;Label Grid.Row="6" Grid.Column="0" Content="Address:"/&gt;
  
          &lt;CheckBox Name="ColonyResident" Content="Colony Resident" Grid.Row="0" Grid.Column="0" Margin="5" Checked="ColonyResident_Checked" Unchecked="ColonyResident_Unchecked"/&gt;
          &lt;TextBox Name="SearchFamilyMemberId" IsEnabled="False" SelectionChanged="FamilyMemberId_SelectionChanged" Grid.Row="0" Grid.Column="1" Margin="3"/&gt;
          &lt;TextBox Name="FamilyMemberId"  IsEnabled="False" Grid.Row="1" Grid.Column="1" Margin="3" Grid.ColumnSpan="2"/&gt;
          &lt;TextBox Name="FirstName" Grid.Row="2" Grid.Column="1" Margin="3" Grid.ColumnSpan="2"/&gt;
          &lt;TextBox Name="LastName" Grid.Row="3" Grid.Column="1" Margin="3" Grid.ColumnSpan="2"/&gt;
          &lt;RadioButton Name="Male"  Grid.Row="4" Grid.Column="1" Margin="3" Content="Male" /&gt;
          &lt;RadioButton Name="Female" Grid.Row="4" Grid.Column="2" Margin="3" Content="Female" /&gt;
          &lt;TextBox Name="Phone" Grid.Row="5" Grid.Column="1" Margin="3" Grid.ColumnSpan="2"/&gt;
          &lt;TextBox Name="Address" Grid.Row="6" Grid.Column="1" Margin="3" Grid.ColumnSpan="2" TextWrapping="Wrap"/&gt;
          &lt;Button Name="Search" IsEnabled="False" Grid.Row="0" Grid.Column="2" Margin="3" MinWidth="100" MinHeight="25" HorizontalAlignment="Center" Content="Search" Click="Search_Click"/&gt;
          &lt;Button IsDefault="True" Grid.Row="7" Grid.Column="1" Margin="3" MinWidth="100" MinHeight="25" HorizontalAlignment="Center" Content="Add" Click="Add_Click"/&gt;
          &lt;Button Grid.Row="7" Grid.Column="2" Margin="3" MinWidth="100" MinHeight="25" HorizontalAlignment="Center" Content="Clear" Click="Clear_Click"/&gt;
  
      &lt;/Grid&gt;
  </code></pre>