倒腾了半天,发现还是无法直接在编辑器里插入SL,直接切换到html视图,贴上sl的object代码后,一发布,居然自动识别为flash,无奈只能用iframe才搞定

 

 


<UserControl

    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"

    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

    xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"

    x:Class="SilverlightApplication1.MainControl"

    mc:Ignorable="d">


    <Grid x:Name="LayoutRoot" Background="White" Height="240" Width="560">

        <Rectangle Stroke="#FF000000" RadiusX="10" RadiusY="10" x:Name="Rect" >

            <Rectangle.Effect>

                <BlurEffect/>

            </Rectangle.Effect>

            <Rectangle.Fill>

                <LinearGradientBrush EndPoint="0.034,1.1" StartPoint="0.403,-0.109">

                    <GradientStop Color="#FF000000"/>

                    <GradientStop Color="#FFFFFFFF" Offset="1"/>

                </LinearGradientBrush>

            </Rectangle.Fill>

        </Rectangle>

        <TextBlock TextWrapping="Wrap" FontSize="52" Foreground="White" d:LayoutOverrides="Width, Height" TextAlignment="Center" MouseEnter="TextBlock_MouseEnter" x:Name="Txt" MouseLeave="TextBlock_MouseLeave" HorizontalAlignment="Center" VerticalAlignment="Center" Cursor="Hand">

            <TextBlock.Effect>

                <BlurEffect/>

            </TextBlock.Effect><Run Text="菩提树下的杨过"/></TextBlock>


    </Grid>

</UserControl>


 


 


using System.Windows.Controls;

using System.Windows.Input;

using System.Windows.Media.Effects;


namespace SilverlightApplication1

{

    public partial class MainControl : UserControl

    {

        public MainControl()

        {

            

            InitializeComponent();

        }


        private void TextBlock_MouseEnter(object sender, MouseEventArgs e)

        {

           

            DropShadowEffect _Effect = new DropShadowEffect();

            _Effect.BlurRadius = 5;

            _Effect.Direction = 225;

            Txt.Effect = _Effect;

            Rect.Effect = Txt.Effect;

        }


        private void TextBlock_MouseLeave(object sender, MouseEventArgs e)

        {

            

            BlurEffect _Effect = new BlurEffect();

            _Effect.Radius = 5;

            Txt.Effect = _Effect;

            Rect.Effect = Txt.Effect;

        }

    }

}


  

 

作者:菩提树下的杨过