Friday, February 15, 2008 12:45 PMHi.
I'am trying to fully replace combobox items list by reassigning ItemsSource to a new List. However combobox still draws "old" items. Combobox has correct ItemsCollection and ItemsSource but draws incorrect data.
Why this happens?
please, look at the small code piece to reproduce the problem.
2nd combo draws incorrect data when the item is selected and then you change selection in 1st combo.
Title="WPFComboTest" Height="385" Width="424"
<ComboBox Name="cmb1" Height="26" Margin="102,75,193,0" VerticalAlignment="Top" DisplayMemberPath="DisplayName" />
<ComboBox Name="cmb2" Height="26" Margin="103,130,192,0" VerticalAlignment="Top" DisplayMemberPath="DisplayName"/>
public partial class Window1 : System.Windows.Window
internal class ComboItem
private string _displayName;
public string DisplayName
internal ComboItem( string displayName)
_displayName = displayName;
cmb1.SelectionChanged += new SelectionChangedEventHandler(cmb1_SelectionChanged);
cmb1.ItemsSource = GetList(100, 103);
void cmb1_SelectionChanged(object sender, SelectionChangedEventArgs e)
cmb2.ItemsSource = GetList(200, 200 + cmb1.SelectedIndex );
private List<ComboItem> GetList(int lowerBound, int upperBound)
List<ComboItem> list = new List<ComboItem>();
for (int i = lowerBound; i <= upperBound; i++)
Monday, February 18, 2008 8:26 AMThe code you posted above works pretty well for me, so I guess you might have other things messed up here.
Monday, February 18, 2008 3:45 PM
Hi again. Have some new details.
This is a problem of combobox redrawing. It shows selection box with incorrect height.
It seems it takes height from the previous opening.
However if I press 'Down arrow' i can select item in combo, so combo contains correct list.
Steps to reproduce:
1. Select '100' in 1st combobox
2. Select '200' in 2nd combobox
3. Select '102' in 1st combobox
4. Open 2nd combobox.
Result: height is for 1 item
Expected: height is for 4 items
link to screenshot
Details: OS Win2k3 + latest updates, .net 3.0
Tuesday, February 19, 2008 2:40 AMHave you tried installing the .NET Framework 3.5 RTM to see if the problem still exists? I remember this problem has occured in .NET Framework 3.5 Beta, but from my experience, it never happens in .NET Framework 3.0 RTM.
Wednesday, February 20, 2008 1:33 PMThanks Marco.
The problem has been solved as i installed the 3.5 RTM.
I hope it really will not appear if customer has 3.0 only.
Monday, January 26, 2009 2:23 PMI am having this problem with 3.5RTM