public AutoCompleteBoxPage()
        {
            this.InitializeComponent();

            States = BuildAllStates();

            foreach (AutoCompleteBox box in GetAllAutoCompleteBox())
            {
                box.Items = States;
            }

            var converter = new FuncMultiValueConverter <string, string>(parts =>
            {
                return(String.Format("{0} ({1})", parts.ToArray()));
            });
            var binding = new MultiBinding {
                Converter = converter
            };

            binding.Bindings.Add(new Binding("Name"));
            binding.Bindings.Add(new Binding("Abbreviation"));

            var multibindingBox = this.FindControl <AutoCompleteBox>("MultiBindingBox");

            multibindingBox.ValueMemberBinding = binding;

            var asyncBox = this.FindControl <AutoCompleteBox>("AsyncBox");

            asyncBox.AsyncPopulator = PopulateAsync;
        }
        public void MultiValueConverter_Should_Not_Skip_Valid_Default_ValueType_Value()
        {
            var target = new FuncMultiValueConverter <StringValueTypeWrapper, string>(v => string.Join(",", v.ToArray()));

            IList <object> create(string[] values) =>
            values.Select(v => (object)(v != null ? new StringValueTypeWrapper()
            {
                Value = v
            } : default)).ToList();
        public void MultiValueConverter_Should_Not_Skip_Valid_Null_ReferenceType_Value()
        {
            var target = new FuncMultiValueConverter <string, string>(v => string.Join(",", v.ToArray()));

            object value = target.Convert(new[] { "Foo", "Bar", "Baz" }, typeof(string), null, CultureInfo.InvariantCulture);

            Assert.Equal("Foo,Bar,Baz", value);

            value = target.Convert(new[] { null, "Bar", "Baz" }, typeof(string), null, CultureInfo.InvariantCulture);

            Assert.Equal(",Bar,Baz", value);
        }
        public AutoCompleteBoxPage()
        {
            this.InitializeComponent();

            States    = BuildAllStates();
            Sentences = BuildAllSentences();

            foreach (AutoCompleteBox box in GetAllAutoCompleteBox().Where(x => x.Name != "CustomAutocompleteBox"))
            {
                box.Items = States;
            }

            var converter = new FuncMultiValueConverter <string, string>(parts =>
            {
                return(String.Format("{0} ({1})", parts.ToArray()));
            });
            var binding = new MultiBinding {
                Converter = converter
            };

            binding.Bindings.Add(new Binding("Name"));
            binding.Bindings.Add(new Binding("Abbreviation"));

            var multibindingBox = this.FindControl <AutoCompleteBox>("MultiBindingBox");

            multibindingBox.ValueMemberBinding = binding;

            var asyncBox = this.FindControl <AutoCompleteBox>("AsyncBox");

            asyncBox.AsyncPopulator = PopulateAsync;

            var customAutocompleteBox = this.FindControl <AutoCompleteBox>("CustomAutocompleteBox");

            customAutocompleteBox.Items        = Sentences.SelectMany(x => x);
            customAutocompleteBox.TextFilter   = LastWordContains;
            customAutocompleteBox.TextSelector = AppendWord;
        }