Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / wpf / src / Framework / System / Windows / TemplateContentLoader.cs / 1305600 / TemplateContentLoader.cs
using System;
using System.ComponentModel;
using System.Xaml;
namespace System.Windows
{
public class TemplateContentLoader : XamlDeferringLoader
{
public override object Load(XamlReader xamlReader, IServiceProvider serviceProvider)
{
if (serviceProvider == null)
{
throw new ArgumentNullException("serviceProvider");
}
else if (xamlReader == null)
{
throw new ArgumentNullException("xamlReader");
}
IXamlObjectWriterFactory factory = RequireService(serviceProvider);
return new TemplateContent(xamlReader, factory, serviceProvider);
}
private static T RequireService(IServiceProvider provider) where T : class
{
T result = provider.GetService(typeof(T)) as T;
if (result == null)
{
throw new InvalidOperationException(SR.Get(SRID.DeferringLoaderNoContext,typeof(TemplateContentLoader).Name, typeof(T).Name));
}
return result;
}
public override XamlReader Save(object value, IServiceProvider serviceProvider)
{
throw new NotSupportedException(SR.Get(SRID.DeferringLoaderNoSave, typeof(TemplateContentLoader).Name));
}
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
// Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- InertiaRotationBehavior.cs
- CustomPeerResolverService.cs
- EventHandlerList.cs
- SchemaMerger.cs
- CodeAssignStatement.cs
- GridItemPattern.cs
- DocumentViewerHelper.cs
- IntegerValidatorAttribute.cs
- DataSource.cs
- DataGridViewAdvancedBorderStyle.cs
- HorizontalAlignConverter.cs
- SafeNativeMethods.cs
- TextTreeTextBlock.cs
- SQLCharsStorage.cs
- ISessionStateStore.cs
- RulePatternOps.cs
- AuthenticationConfig.cs
- MenuBindingsEditorForm.cs
- CompensationHandlingFilter.cs
- DocumentProperties.cs
- ContourSegment.cs
- XmlHierarchicalEnumerable.cs
- MultilineStringConverter.cs
- AsynchronousChannelMergeEnumerator.cs
- RoleManagerModule.cs
- KeyManager.cs
- WmfPlaceableFileHeader.cs
- AnyAllSearchOperator.cs
- CharEntityEncoderFallback.cs
- MemoryFailPoint.cs
- CompareValidator.cs
- DesignTimeParseData.cs
- ItemTypeToolStripMenuItem.cs
- DirectoryNotFoundException.cs
- RegisteredScript.cs
- SafeNativeMethods.cs
- NavigationPropertyEmitter.cs
- MetafileHeaderWmf.cs
- WizardForm.cs
- QueryCacheManager.cs
- GcHandle.cs
- HostVisual.cs
- WebScriptEnablingBehavior.cs
- GridItemCollection.cs
- KeyboardNavigation.cs
- PackageFilter.cs
- WebControl.cs
- SqlConnectionString.cs
- UrlMapping.cs
- RegexMatchCollection.cs
- AssemblyNameProxy.cs
- CheckBoxPopupAdapter.cs
- Transform3D.cs
- PointAnimationClockResource.cs
- PixelFormat.cs
- BasicHttpMessageSecurity.cs
- WebServiceMethodData.cs
- EllipseGeometry.cs
- MethodBuilder.cs
- XmlText.cs
- basevalidator.cs
- EpmSyndicationContentSerializer.cs
- EntityChangedParams.cs
- ToolboxItem.cs
- ArgumentOutOfRangeException.cs
- URLBuilder.cs
- Configuration.cs
- DrawingState.cs
- ServerIdentity.cs
- FormatConvertedBitmap.cs
- SelectionRangeConverter.cs
- ILGenerator.cs
- NullNotAllowedCollection.cs
- HtmlUtf8RawTextWriter.cs
- _RequestCacheProtocol.cs
- Win32MouseDevice.cs
- SiteMapHierarchicalDataSourceView.cs
- XmlMemberMapping.cs
- DataServiceConfiguration.cs
- FullTextLine.cs
- ImmutableCollection.cs
- SelectionEditingBehavior.cs
- ParseHttpDate.cs
- WsdlInspector.cs
- MenuScrollingVisibilityConverter.cs
- Point3DValueSerializer.cs
- StringBuilder.cs
- SiteMap.cs
- StackBuilderSink.cs
- BinHexDecoder.cs
- StrokeSerializer.cs
- ListComponentEditorPage.cs
- TcpHostedTransportConfiguration.cs
- KeyedCollection.cs
- ReachPageContentCollectionSerializerAsync.cs
- ListDataHelper.cs
- EffectiveValueEntry.cs
- CompareInfo.cs
- DbConnectionHelper.cs
- MetafileEditor.cs