コード例 #1
0
        public static ResourceDictionary CreateDynamicDataTemplates([NotNull] ExportProvider exportProvider)
        {
            var dataTemplateResources = new ResourceDictionary();

            var exportMetaData = exportProvider.GetDataTemplateExportsMetadata();

            foreach (var item in exportMetaData)
            {
                var viewModel = item.ViewModel;
                var role      = item.Role;

                var template = CreateTemplate(viewModel, role);

                dataTemplateResources.Add(CreateKey(viewModel, role), template);
            }

            return(dataTemplateResources);
        }
コード例 #2
0
        public static ResourceDictionary CreateDynamicDataTemplates([NotNull] ExportProvider exportProvider)
        {
            Contract.Requires(exportProvider != null);
            Contract.Ensures(Contract.Result <ResourceDictionary>() != null);

            var dataTemplateResources = new ResourceDictionary();

            var exportMetaData = exportProvider.GetDataTemplateExportsMetadata();

            foreach (var item in exportMetaData)
            {
                Contract.Assume(item != null);

                var viewModel = item.ViewModel;
                var role      = item.Role;

                var template = CreateTemplate(viewModel, role);

                dataTemplateResources.Add(CreateKey(viewModel, role), template);
            }

            return(dataTemplateResources);
        }