- You all finished?
- Yeup, it compiles!
At the end of the day yesterday I thought I had made a bit of progress with my filtered-combo box. Unfortunately, though it compiles, I’ve found that I can’t get my app loaded and binding to that event at run-time gives me an exception.
However, in looking for a solution, I found the DependencyPropertyDescriptor object, which allows us to access dependency properties from code. Using this object I can now observe the text for changes and add my event handler as such:
public Window1()
{
InitializeComponent();
DependencyPropertyDescriptor comboText;
comboText = DependencyPropertyDescriptor.FromProperty(ComboBox.TextProperty, typeof(ComboBox));
comboText.AddValueChanged(this, this.ComboTextChanged);
}
private void ComboTextChanged(object sender, EventArgs e)
{
// ...
}
No comments:
Post a Comment