You can add an opacity effect to a reflection using the standard Silverlight drop shadow effect. In this topic, you will add the drop shadow effect in Blend, in XAML, and in code.
At Design Time in Blend
To use the opacity effect, complete the following steps:
Add a C1Reflector control to your Blend project.
Select the C1Reflector control once to select it.
Under the Properties panel, click the ReflectionEffects ellipsis button to open the Effect Collection Editor: ReflectionEffects dialog box.
Click Add another item. The Select Object dialog box opens.
Select ReflectionOpacityEffect from the list and then click OK to add the effect to the control and return to the Effect Collection Editor: ReflectionEffects dialog box.
In the Properties grid, set the following properties:
Set the ReflectionOpacityEffect.Coefficient property to "1".
Set the ReflectionOpacityEffect.Offset property to "0.5".
Press OK to close the Effect Collection Editor: ReflectionEffects dialog box.
At Design Time in Blend
To use the opacity effect, complete the following steps:
Add a C1Reflector control to your Blend project.
Add Content="C1Reflector" to the <c1ext:C1Reflector> tag to set string content.
Add the opacity effect and set its properties by placing the following XAML between the <c1ext:C1Reflector> and </c1ext:C1Reflector> tags:
XAML |
Copy Code
|
---|---|
<c1ext:C1Reflector.ReflectionEffects> <c1ext:ReflectionOpacityEffect Coefficient="1" Offset="0.5"/> </c1ext:C1Reflector.ReflectionEffects> |
In Code
To use the opacity effect, complete the following steps:
Add a C1Reflector control to your Blend project.
Add Content="C1Reflector" to the <c1ext:C1Reflector> tag to set string content.
Add x:Name=C1Reflector1 to the <c1ext:C1Reflector> tag. This will give the control a unique identifier that you can use to call it in code.
Switch to Code view and import the following namespace:
Visual Basic |
Copy Code
|
---|---|
Imports C1.Silverlight.Extended |
C# |
Copy Code
|
---|---|
using C1.Silverlight.Extended;
|
Add the following beneath the InitializeComponent() method:
Visual Basic |
Copy Code
|
---|---|
'Create the ReflectionOpacityEffect object and set its properties Dim newOpacity As New ReflectionOpacityEffect() newOpacity.Coefficient = 1 newOpacity.Offset = 0.5 'Add the ReflectionOpacityEffect object to the C1Reflector1 control C1Reflector1.ReflectionEffects.Add(newOpacity) |
C# |
Copy Code
|
---|---|
//Create the ReflectionOpacityEffect object and set its properties ReflectionOpacityEffect newOpacity = new ReflectionOpacityEffect(); newOpacity.Coefficient = 1; newOpacity.Offset = 0.5; //Add the ReflectionOpacityEffect object to the C1Reflector1 control C1Reflector1.ReflectionEffects.Add(newOpacity); |
Run the program.