TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Magnus Ahlin
NA
1
1.5k
DataGrid rows bound to the same row.
Jun 15 2011 1:24 PM
Im using WPF4 and I have a datagrid bound to to a collection of instances of a plain class.
It works fine for most of the columns but one column bound to s string property is a template column with a combobox in it which is populated from a object dataprovider.
it works fine, however, when I add more than one row and select a different item all rows gets updated with that value. I can change the other columns without this happening.
Any ideas?
<DataTemplate x:Key="subIndexComboBoxCellTemplate" >
<ComboBox SelectedItem="{Binding Code, UpdateSourceTrigger=PropertyChanged}" Padding="0" Margin="0">
<ComboBox.ItemsSource>
<Binding>
<Binding.Source>
<StaticResource ResourceKey="indexCodes" />
</Binding.Source>
</Binding>
</ComboBox.ItemsSource>
</ComboBox>
</DataTemplate>
<DataGrid ScrollViewer.CanContentScroll="True" ItemsSource="{Binding SubIndices}" Margin="5" CanUserAddRows="False" AutoGenerateColumns="False" >
<DataGrid.Columns>
<DataGridTemplateColumn Header="Sub Index Code" CellEditingTemplate="{StaticResource subIndexComboBoxCellTemplate}" CellTemplate="{StaticResource subIndexComboBoxCellTemplate}" />
Reply
Answers (
3
)
Which is the best WPF or Silverlight?
C# - Button Glow