Adding the AutoCompleteBox

Oct 8, 2015 at 1:22 AM
When adding an AutoCompleteBox I have to:
  1. Reference the assemblies
  2. Add the AutoCompleteBox control as XAML
  3. Add 2 Styles and 2 Control Templates to my resources
  4. Add DropDownToggle_Click and Text_Initialized methods to my code behind
Is the AutoCompleteBox meant to be a reusable control? If so, isn't that 2 steps too many?
Why are steps 3 and 4 required?

Nov 18, 2015 at 11:44 AM
Pretty late answer, but the things you point our are to use an AutoCompleteBox as an AutoCompleteComboBox.

If you want to use the AutoCompleteBox, all you need to do is reference the toolkit, put the reference in your xaml code and place the control in your view (step 1 and 2).

If you want AutoCompleteComboBox features like in their sample project you have to do the above + adding 2 styles and/or templates and wiring up a DropDownToggle_Click method. As far as I know the 2nd method you mention isn't necessary.

What I did to get a reusable AutoCompleteComboBox was by following the following tutorial:

It's written for Silverlight but can be applied to WPF. Just place the styles/themes in a Resource Dictionary and place code from req 1, 2 and 3 in a class which I named AutoCompleteComboBox : AutoCompleteBox.