如何在代码背后做silverlight 3模糊效果?

时间:2009-03-27 09:58:38

标签: silverlight silverlight-3.0

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...
}

1 个答案:

答案 0 :(得分:1)

仅限Silverlight 3

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