Overview This is a simple example that binds a button click from one button to the color property of another button using the WPF controls in Measurement Studio.
Description This example is simple example that demonstrates how to bind an action, in this case a mouse click, to change a property on another contorl. In this example we are changing the case the color of another button. There are a few key pieces of code required to make this successful. One is in the XAML itself:
In this snippet, we can see that we are binding the background color of the BooleanButton to MyBrushProperty. This leads us to the second piece of code that is really nessicary in order to complete this functionality:
public DependencyProperty MyBrushProperty = DependencyProperty.Register(
which is defined in our mainwindow class. This declares our databinding target as a DependencyProperty which is a component that is exposed in the CLR. Essentially it allows us to make changes to properties based on another set of inputs. This code allows us to expose the MyBrushProperty propert as a Depency Property so that we can perform bind data to it.
Visual Studio 2012
Measurement Studio Enterprise 2013 (or compatible)
Steps to Implement or Execute Code
Download and Unzip the file.
Fix an Dependcy issues that you may find run into
Run the Source code.
Click "Click to turn Button 1 Red" in order to change the color of button 1
Close the Application
Additional Information or References Example what the the application looks like after click the button.