打印

不能直接用创建的属性对象作为对象属性值了?

我用CreateFromXaml创建了一个EventTrigger对象,本来记得以前在一个版本的SDK看到可以直接将属性对象作为Canvas.Triggers属性值,结果出错了,检查了一遍也没找出问题,查了下最新的SDK竟然没找到"创建线性渐变的 Brush 对象"哪一段了,难道微软改了?知道的兄弟帮帮忙,谢谢

[ 本帖最后由 liang102938 于 2008-1-11 12:13 编辑 ]

TOP

是可以的
// MouseEnter event handler for the Ellipse object.
function onMouseEnter(sender, eventArgs)
{
    // Set the Fill property of the Ellipse to the dynamically generated LinearGradientBrush.

    try
    {
    sender.fill = createLinearGradientBrush(sender.getHost());
    }
    catch(error)
    {
        alert(error.message);
    }
}

function createLinearGradientBrush(plugin)
{
    // Define a XAML fragment.
    var xamlFragment = '<LinearGradientBrush>';
       xamlFragment +=   '<GradientStop Color="Yellow" Offset="0.0" />';
       xamlFragment +=   '<GradientStop Color="Orange" Offset="0.5" />';
       xamlFragment +=   '<GradientStop Color="Red" Offset="1.0" />';
       xamlFragment += '</LinearGradientBrush>';

    // Create the XAML fragment and return it.
    return plugin.content.createFromXaml(xamlFragment, false);
}

TOP