protected override bool CreateChildren(bool diffOldChildren) { try { object[] rgobjs = (object[])objValue; ChildCollection.Clear(); MultiPropertyDescriptorGridEntry[] mergedProps = PropertyMerger.GetMergedProperties(rgobjs, this, this.PropertySort, CurrentTab); Debug.WriteLineIf(CompModSwitches.DebugGridView.TraceVerbose && mergedProps == null, "PropertyGridView: MergedProps returned null!"); if (mergedProps != null) { ChildCollection.AddRange(mergedProps); } bool fExpandable = this.Children.Count > 0; if (!fExpandable) { //Debug.WriteLine("Object " + rgobjs[0].GetType().FullName + " is not expandable because it has no children"); SetFlag(GridEntry.FL_EXPANDABLE_FAILED, true); } CategorizePropEntries(); return(fExpandable); } catch { return(false); } }
protected void RecalculateTemplateBindableProperties() { this.templateBindableProperties.Clear(); SceneNode[] objects = this.Objects; if (objects.Length != 1) { return; } SceneNode sceneNode = objects[0]; if (sceneNode == null || sceneNode.StoryboardContainer == null || !typeof(ControlTemplateElement).IsAssignableFrom(sceneNode.StoryboardContainer.GetType()) || !sceneNode.Platform.Metadata.IsCapabilitySet(PlatformCapability.SupportNonFrameworkElementTemplateBinding) && !PlatformTypes.FrameworkElement.IsAssignableFrom((ITypeId)sceneNode.Type)) { return; } Type targetElementType = sceneNode.StoryboardContainer.TargetElementType; if (!(targetElementType != (Type)null)) { return; } IList <TargetedReferenceStep> mergedProperties = PropertyMerger.GetMergedProperties((IEnumerable <SceneNode>) new SceneNode[1] { sceneNode.ViewModel.CreateSceneNode(targetElementType) }); IProjectContext projectContext = sceneNode.ProjectContext; foreach (TargetedReferenceStep targetedReferenceStep in (IEnumerable <TargetedReferenceStep>)mergedProperties) { DependencyPropertyReferenceStep referenceStep = targetedReferenceStep.ReferenceStep as DependencyPropertyReferenceStep; if (referenceStep != null) { bool showReadOnly = true; if (PropertyInspectorModel.IsPropertyBrowsable(objects, targetedReferenceStep, showReadOnly) && PropertyInspectorModel.IsAttachedPropertyBrowsable(objects, this.ObjectTypeId, targetedReferenceStep, (ITypeResolver)projectContext)) { this.templateBindableProperties.Add(new TemplateBindablePropertyModel(referenceStep)); } } } this.templateBindableProperties.Sort((Comparison <TemplateBindablePropertyModel>)((left, right) => string.Compare(left.PropertyName, right.PropertyName, StringComparison.CurrentCulture))); this.OnPropertyChanged("TemplateBindableProperties"); }
protected override bool CreateChildren(bool diffOldChildren) { try { object[] objValue = (object[])base.objValue; base.ChildCollection.Clear(); MultiPropertyDescriptorGridEntry[] entryArray = PropertyMerger.GetMergedProperties(objValue, this, base.PropertySort, this.CurrentTab); if (entryArray != null) { base.ChildCollection.AddRange(entryArray); } bool flag = this.Children.Count > 0; if (!flag) { this.SetFlag(0x80000, true); } base.CategorizePropEntries(); return(flag); } catch { return(false); } }
private void AddElementPropertiesWithTypeFilter(SceneElement targetElement, ResourceEntryItem resource, System.Windows.Controls.ItemCollection menuItems, Type filterType) { SceneNode[] selection = new SceneNode[1] { (SceneNode)targetElement }; foreach (TargetedReferenceStep targetedReferenceStep in (IEnumerable <TargetedReferenceStep>)PropertyMerger.GetMergedProperties((IEnumerable <SceneNode>)selection)) { ReferenceStep referenceStep = targetedReferenceStep.ReferenceStep; if (referenceStep.Name != "Name" && PropertyInspectorModel.IsPropertyBrowsable(selection, targetedReferenceStep) && (PropertyInspectorModel.IsAttachedPropertyBrowsable(selection, targetElement.Type, targetedReferenceStep, (ITypeResolver)targetElement.ProjectContext) && PlatformTypeHelper.GetPropertyType((IProperty)referenceStep) != (Type)null) && (PlatformTypeHelper.GetPropertyType((IProperty)referenceStep).IsAssignableFrom(resource.Resource.Type.RuntimeType) && (filterType == (Type)null || filterType.IsAssignableFrom(PlatformTypeHelper.GetPropertyType((IProperty)referenceStep))))) { menuItems.Add((object)this.BuildPropertyMenuItem(targetElement, referenceStep, resource)); } } }
private static IList <ReferenceStep> GetBindablePropertiesInternal(SceneNode sceneNode, int maxCount, BindingPropertyHelper.BindingType bindingType) { List <ReferenceStep> list = new List <ReferenceStep>(); if (!BindingPropertyHelper.IsBindableSceneNode(sceneNode)) { return((IList <ReferenceStep>)list); } bool isDeclaringTypeBindable = BindingPropertyHelper.IsBindableType(sceneNode.Type.NearestResolvedType, bindingType); foreach (TargetedReferenceStep targetedReferenceStep in (IEnumerable <TargetedReferenceStep>)PropertyMerger.GetMergedProperties((IEnumerable <SceneNode>) new SceneNode[1] { sceneNode })) { if ((!BindingPropertyHelper.IsTargetMode(bindingType) || BindingPropertyHelper.IsPropertyBindableAsTarget(sceneNode, targetedReferenceStep.ReferenceStep, isDeclaringTypeBindable)) && (!BindingPropertyHelper.IsSourceMode(bindingType) || BindingPropertyHelper.IsPropertyBindableAsSource(sceneNode, targetedReferenceStep.ReferenceStep))) { list.Add(targetedReferenceStep.ReferenceStep); if (list.Count >= maxCount) { break; } } } return((IList <ReferenceStep>)list); }