private PropModelType FetchPropModel(string resourceKey) { try { if (CanFindPropBagTemplateWithJustKey) { PropBagTemplate pbt = _propBagTemplateBuilder.GetPropBagTemplate(resourceKey); PropModelType pm = _pbtParser.ParsePropModel(pbt); FixUpPropFactory(pm, _propFactoryFactory); return(pm); } else if (HasPbtLookupResources) { throw new InvalidOperationException($"A call providing only a ResourceKey can only be done, " + $"if this PropModelBuilder was supplied with a PropBagTemplateBuilder upon construction. " + $"No class implementing: {nameof(IPropBagTemplateBuilder)} was provided. " + $"Please supply a PropBagTemplate object."); } else { throw new InvalidOperationException($"A call providing only a ResourceKey can only be done, " + $"if this PropModelBuilder was supplied with the necessary resources upon construction. " + $"A {_propBagTemplateBuilder.GetType()} was provided, but it does not have the necessary resources. " + $"Please supply a ResourceDictionary and ResourceKey or a ProbBagTemplate object."); } } catch (System.Exception e) { throw new ApplicationException($"PropBagTemplate for ResourceKey = {resourceKey} was not found.", e); } }
public PropModelType GetPropModel(ResourceDictionary rd, string resourceKey) { try { if (HasPbtLookupResources) { PropBagTemplate pbt = _propBagTemplateBuilder.GetPropBagTemplate(resourceKey); PropModelType pm = _pbtParser.ParsePropModel(pbt); FixUpPropFactory(pm, _propFactoryFactory); return(pm); } else { throw new InvalidOperationException($"A call providing a ResourceDictionary and a ResouceKey can only be done, " + $"if this PropModelBuilder was supplied with a resource upon construction. " + $"No class implementing: {nameof(IPropBagTemplateBuilder)} was provided."); } } catch (System.Exception e) { throw new ApplicationException("Resource was not found.", e); } }
private DRM.PropBagControlsWPF.TypeInfoField GetWrapperTypeInfo(PropBagTemplate pbt) { DRM.PropBagControlsWPF.TypeInfoField ptif = pbt.Items.OfType <DRM.PropBagControlsWPF.TypeInfoField>().FirstOrDefault(); return(ptif); }