WPF using a ComboBox as a record selector

  • Thread starter Thread starter Bill McCormick
  • Start date Start date
B

Bill McCormick

Hello,

I have a ComboBox on a Grid:

<ComboBox Name="cmbItemId"
ItemsSource="{Binding}"
DisplayMemberPath="ItemId"
SelectedValuePath="ItemId"/>

The DataContext of the Grid is:

var items = from it in _db.Items
select it;
ItemGrid.DataContext = items.ToList();

So the ComboBox just diplays a list of ItemId's; nothin' fancy.

No, I've got a TextBox that I want to display/edit the selected Item
description:

<TextBox Grid.Column="3"
Grid.Row="0"
Text="{Binding ?????}"/>

What should the binding be set to? Is this possible to do binding
LinqToSql?


Thanks,

Bill
 
Bill said:
Hello,

I have a ComboBox on a Grid:

<ComboBox Name="cmbItemId"
ItemsSource="{Binding}"
DisplayMemberPath="ItemId"
SelectedValuePath="ItemId"/>

The DataContext of the Grid is:

var items = from it in _db.Items
select it;
ItemGrid.DataContext = items.ToList();

So the ComboBox just diplays a list of ItemId's; nothin' fancy.

No, I've got a TextBox that I want to display/edit the selected Item
description:

<TextBox Grid.Column="3"
Grid.Row="0"
Text="{Binding ?????}"/>

What should the binding be set to? Is this possible to do binding
LinqToSql?
I figured this one out by myself too.
 
Bill said:
Hello,

I have a ComboBox on a Grid:

<ComboBox Name="cmbItemId"
ItemsSource="{Binding}"
DisplayMemberPath="ItemId"
SelectedValuePath="ItemId"/>

The DataContext of the Grid is:

var items = from it in _db.Items
select it;
ItemGrid.DataContext = items.ToList();

So the ComboBox just diplays a list of ItemId's; nothin' fancy.

No, I've got a TextBox that I want to display/edit the selected Item
description:

<TextBox Grid.Column="3"
Grid.Row="0"
Text="{Binding ?????}"/>

What should the binding be set to? Is this possible to do binding
LinqToSql?
I figured this one out by myself too.
 
Back
Top