///<summary> /// Adds a ComboBox to the FilterControlControl for filtering on a Boolean Property. /// This allows the Developer to set a filter that allows the user to select true, false or nothing. /// (this is similar to a tristate CheckBox but is usually easier for a user). ///</summary> ///<param name="labelText">The Filter Label</param> ///<param name="propertyName">The property to filter on</param> ///<param name="defaultValue"></param> ///<returns>The custom filter that is created.</returns> public ICustomFilter AddBooleanFilterComboBox(string labelText, string propertyName, bool?defaultValue) { ICustomFilter filterControl = new BoolComboBoxFilter(_controlFactory, propertyName); AddCustomFilter(labelText, filterControl); var comboBox = ((IComboBox)filterControl.Control); comboBox.SelectedItem = Convert.ToString(defaultValue); return(filterControl); }
public void Test_Construct_BoolComboBoxFilter_ShouldSetOptionsTrueAndFalse() { //---------------Set up test pack------------------- const string expectedPropName = "TestColumn"; //---------------Assert Precondition---------------- //---------------Execute Test ---------------------- var boolComboBoxFilter = new BoolComboBoxFilter(GetControlFactory(), expectedPropName); //---------------Test Result ----------------------- var comboBox = (IComboBox)boolComboBoxFilter.Control; Assert.AreEqual(3, comboBox.Items.Count); Assert.IsTrue(comboBox.Items.Contains("True"), "Should Contain True"); Assert.IsTrue(comboBox.Items.Contains("False"), "Should Contain False"); }
public void Test_Construct_BoolComboBoxFilter_ShouldSetPropNameAndFilterOperator() { //---------------Set up test pack------------------- const string expectedPropName = "TestColumn"; //---------------Assert Precondition---------------- //---------------Execute Test ---------------------- var boolComboBoxFilter = new BoolComboBoxFilter(GetControlFactory(), expectedPropName); //---------------Test Result ----------------------- Assert.AreEqual(expectedPropName, boolComboBoxFilter.PropertyName); Assert.AreEqual(FilterClauseOperator.OpEquals, boolComboBoxFilter.FilterClauseOperator); Assert.IsInstanceOf<IComboBox>(boolComboBoxFilter.Control); }
///<summary> /// Adds a ComboBox to the FilterControlControl for filtering on a Boolean Property. /// This allows the Developer to set a filter that allows the user to select true, false or nothing. /// (this is similar to a tristate CheckBox but is usually easier for a user). ///</summary> ///<param name="labelText">The Filter Label</param> ///<param name="propertyName">The property to filter on</param> ///<param name="defaultValue"></param> ///<returns>The custom filter that is created.</returns> public ICustomFilter AddBooleanFilterComboBox(string labelText, string propertyName, bool? defaultValue) { ICustomFilter filterControl = new BoolComboBoxFilter(_controlFactory, propertyName); AddCustomFilter(labelText, filterControl); var comboBox = ((IComboBox) filterControl.Control); comboBox.SelectedItem = Convert.ToString(defaultValue); return filterControl; }