【问题标题】:How to do silverlight 3 blur effect in code behind?如何在代码后面做silverlight 3模糊效果?
【发布时间】:2009-03-27 09:58:37
【问题描述】:

silverlight 3 中的模糊效果很好:

<StackPanel HorizontalAlignment="Left">
    <Button x:Name="Button1"
    Content="Click This"
    Click="Button1_Click">
        <Button.Effect>
            <BlurEffect Radius="2"/>
        </Button.Effect>
    </Button>
</StackPanel>

但是我将如何在后面的代码中做到这一点:

private void Button1_Click(object sender, RoutedEventArgs e)
{
    Button1.Content = "was clicked";
    //Button1.Effect.bl...
}

【问题讨论】:

    标签: silverlight silverlight-3.0


    【解决方案1】:

    仅限 Silverlight 3

    private void Button1_Click(object sender, RoutedEventArgs e)
    {
        ((Button)sender).Content = "was clicked";
        ((Button)sender).Effect = new BlurEffect { Radius = 8 };
    }
    

    【讨论】:

    • 谢谢,注意你还需要: using System.Windows.Media.Effects;
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-07-20
    • 1970-01-01
    相关资源
    最近更新 更多