ColorPicker > Quick Start: ColorPicker for WPF > Step 3 of 4: Adding Code to the Application |
Complete the following steps:
Visual Basic Copy Code Imports C1.WPF Imports C1.WPF.Extended
C# Copy Code using C1.WPF; using C1.WPF.Extended;
Visual Basic Copy Code Private Sub UpdateGradient() If C1ColorPicker1 IsNot Nothing And C1ColorPicker2 IsNot Nothing Then Me.col1.Color = Me.C1ColorPicker1.SelectedColor Me.col2.Color = Me.C1ColorPicker2.SelectedColor End If End Sub
C# Copy Code void UpdateGradient() { if (c1ColorPicker1 != null & c1ColorPicker2 != null) { this.col1r = this.c1ColorPicker1.SelectedColor; this.col2.Color = this.c1ColorPicker2.SelectedColor; }
Visual Basic Copy Code Private Sub C1ColorPicker1_SelectedColorChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles C1ColorPicker1.SelectedColorChanged UpdateGradient() End Sub
C# Copy Code private void c1ColorPicker1_SelectedColorChanged(object sender, C1.WPF.PropertyChangedEventArgs<System.Windows.Media.Color> e) { UpdateGradient(); }
Visual Basic Copy Code Private Sub C1ColorPicker2_SelectedColorChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles c1cp1.SelectedColorChanged UpdateGradient() End Sub
C# Copy Code private void c1ColorPicker2_SelectedColorChanged(object sender, C1.WPF.PropertyChangedEventArgs<System.Windows.Media.Color> e) { UpdateGradient(); }
In this step you completed adding code to your application. In the next step you'll run the application and observe run-time interactions.