ColorPicker > Quick Start: ColorPicker for Silverlight > Step 3 of 4: Adding Code to the Application |
In the previous steps you set up the application's user interface and added controls to your application. In this step you'll add code to your application to finalize it.
Complete the following steps:
Visual Basic |
Copy Code
|
---|---|
Imports C1.Silverlight Imports C1.Silverlight.Extended |
C# |
Copy Code
|
---|---|
using C1.Silverlight; using C1.Silverlight.Extended; |
Visual Basic |
Copy Code
|
---|---|
Private Sub UpdateGradient() If c1cp1 IsNot Nothing And c1cp2 IsNot Nothing Then Me.col1.Color = Me.c1cp1.SelectedColor Me.col2.Color = Me.c1cp1.SelectedColor End If End Sub |
C# |
Copy Code
|
---|---|
void UpdateGradient() { if (c1cp1 != null & c1cp2 != null) { this.col1.Color = this.c1cp1.SelectedColor; this.col2.Color = this.c1cp2.SelectedColor; } } |
Visual Basic |
Copy Code
|
---|---|
Private Sub c1cp1_SelectedColorChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles c1cp1.SelectedColorChanged UpdateGradient() End Sub |
C# |
Copy Code
|
---|---|
private void c1cp1_SelectedColorChanged(object sender, C1.Silverlight.PropertyChangedEventArgs<System.Windows.Media.Color> e) { UpdateGradient(); } |
Visual Basic |
Copy Code
|
---|---|
Private Sub c1cp2_SelectedColorChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles c1cp1.SelectedColorChanged UpdateGradient() End Sub |
C# |
Copy Code
|
---|---|
private void c1cp2_SelectedColorChanged(object sender, C1.Silverlight.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.