C# Syntax
void Set( CheckedState state )
Parameters
- state
- The value to be assigned to this toggle button. Possible values: HP.LFT.SDK.CheckedState.
// The following code example changes the state of the toggle button. [Test] public void TestWpfToggleButton() { // Identify the application and assign it to an IWindow object. var appMainWindow = Desktop.Describe<IWindow>(new WindowDescription { ObjectName = @"MainWindow", FullType = @"window", WindowTitleRegExp = @"MainWindow" }); // Identify the WPF toggle button. var buttonWithToggleButtonSupport = appMainWindow.Describe<IButton>(new ButtonDescription { Text = @"Toggle Button", ObjectName = @"Button4" }); IToggleButton toggleButton = buttonWithToggleButtonSupport.ToggleButton; // Sets the toggle button's state to checked. toggleButton.Set(CheckedState.Checked); // Changes the toggle button state. if (toggleButton.IsChecked) { toggleButton.Set(CheckedState.Unchecked); } else { toggleButton.Set(CheckedState.Checked); } }