开发者

How do I create a property on a custom silverlight behavior so that expression blend will display the object picker?

I've created a custom behavior with a target control property and I can't figure out how to get blend to display the round "object picker" so that I can drag and drop to ta开发者_StackOverflow中文版rget a particular control. So when I create a behavior like this:

    public class SetFocusAfterBusyBehavior : Behavior<BusyIndicator>
    {
        public object TargetControl { get; set; }

When I try to set the TargetControl property in blend I just get a box with no object picker.

I've tried changing TargetControl to be a dependency property. I've looked at the TargetedTriggerAction class in reflector to see if I could figure out how if there is a special attribute. I also poked around on the web and read this blog which doesn't specifically mention the object picker and also seems like a lot more work than should be necessary.

Is there a simple solution to this? I'm pretty new to silverlight and blend so perhaps I'm missing something very simple.


You can use the CustomPropertyValueEditorAttribute from the System.Windows.Interactivity assembly in combination with one of the value from the CustomPropertyValueEditor enumeration, to get access to some of the provided property editors.

public class SetFocusAfterBusyBehavior : Behavior<BusyIndicator>
{
    [CustomPropertyValueEditor(CustomPropertyValueEditor.Element)]
    public object TargetControl { get; set; }
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜