private void btnSearch_Click(object sender, RoutedEventArgs e) >> { >> this.DataContext = this.Customer.GetCustomersLikeCustomerLastName(this.txtLastNameSearch.Text); >> >> } >>>>
<Custom:DataGrid Margin="5" x:Name="grdCustomers" IsSynchronizedWithCurrentItem="True" Grid.Row="2" ItemsSource="{Binding Mode=OneWay}" SelectionMode="Single" GridLinesVisibility="None" HeadersVisibility="Column" Grid.Column="0" AutoGenerateColumns="False" Grid.ColumnSpan="1" Style="{DynamicResource HDSDataGridStyle}"> >> <Custom:DataGrid.Columns> >> <Custom:DataGridTextColumn Header="Last Name" Width="0.5*" Binding="{Binding cus_LastName, Mode=Default}"/> >> <Custom:DataGridTextColumn Header="First Name" Width="0.5*" Binding="{Binding cus_FirstName, Mode=Default}"/> >> </Custom:DataGrid.Columns> >> </Custom:DataGrid>>>
/// <summary> /// Gets customers that match the partial customerLastName string /// </summary> /// <param name="customerLastName">Partial or full customerLastName string</param> /// <returns>List of Customer entities that match the search criteria</returns> public mmBindingList<CustomerEntity> GetCustomersLikeCustomerLastName(string customerLastName) { IQueryable<CustomerEntity> query = from customer in this.ObjectContext.CustomerEntitySet where customer.cus_lastname.StartsWith(customerLastName) select customer; return this.GetEntityList(query); }still too new to this stuff to be sure how to answer your question. :(