private void RegisterDisplayNameProperty()
        {
            AttachedPropertiesService attachedPropertiesService =
                this.Context.Services.GetService <AttachedPropertiesService>();

            if (attachedPropertiesService == null)
            {
                return;
            }

            IEnumerable <AttachedProperty> properties = attachedPropertiesService.GetAttachedProperties(typeof(ActivityBuilder <>));

            if (properties != null && properties.Contains(displayNameProperty))
            {
                return;
            }

            attachedPropertiesService.AddProperty(displayNameProperty);
        }
Esempio n. 2
0
        void AttachDisplayName()
        {
            AttachedPropertiesService attachedPropertiesService = this.Context.Services.GetService <AttachedPropertiesService>();

            Fx.Assert(attachedPropertiesService != null, "AttachedPropertiesService is not available.");
            Type modelItemType = this.ModelItem.ItemType;

            foreach (AttachedProperty property in attachedPropertiesService.GetAttachedProperties(modelItemType))
            {
                if (property.Name == "DisplayName" && property.OwnerType == modelItemType)
                {
                    return;
                }
            }
            AttachedProperty <string> displayNameProperty = new AttachedProperty <string>
            {
                Name      = "DisplayName",
                OwnerType = modelItemType,
                Getter    = (modelItem) => { return("Case"); }
            };

            attachedPropertiesService.AddProperty(displayNameProperty);
        }