public NamespaceRegistryTests() { type = typeof(DummyClass); registry = new NamespaceRegistry(); registry.RegisterPrefix(new PrefixRegistration("my", "target")); clrNamespace = $"clr-namespace:{type.Namespace};Assembly={type.GetTypeInfo().Assembly}"; registry.RegisterPrefix(new PrefixRegistration("clr", clrNamespace)); registry.AddNamespace( XamlNamespace.Map("target") .With(new[] { Route.Assembly(type.Assembly).WithNamespaces(new[] { type.Namespace }) })); }
public void Initialize() { type = typeof(DummyClass); registry = new NamespaceRegistry(); registry.RegisterPrefix(new PrefixRegistration("my", "target")); clrNamespace = $"clr-namespace:{type.Namespace};Assembly={type.GetTypeInfo().Assembly}"; registry.RegisterPrefix(new PrefixRegistration("clr", clrNamespace)); registry.AddNamespace( XamlNamespace.Map("target") .With(new[] { Route.Assembly(type.Assembly).WithNamespaces(new[] { type.Namespace }) })); }
private static NamespaceRegistry CreateXamlNamespaceRegistry() { var xamlNamespaceRegistry = new NamespaceRegistry(); var windowType = typeof(Window); var textBlockType = typeof(TextBlock); var toggleButtonType = typeof(ToggleButton); var rotateTransformType = typeof(RotateTransform); var bindingType = typeof(BindingExtension); var rootNs = XamlNamespace.Map(WpfRootNs) .With( new[] { Route.Assembly(bindingType.Assembly).WithNamespaces( new[] { bindingType.Namespace }), Route.Assembly(rotateTransformType.Assembly).WithNamespaces( new[] { rotateTransformType.Namespace }), Route.Assembly(bindingType.Assembly).WithNamespaces( new[] { bindingType.Namespace }), Route.Assembly(windowType.Assembly).WithNamespaces( new[] { windowType.Namespace, textBlockType.Namespace, toggleButtonType.Namespace }) }); foreach (var ns in new List <XamlNamespace> { rootNs }) { xamlNamespaceRegistry.AddNamespace(ns); } xamlNamespaceRegistry.RegisterPrefix(new PrefixRegistration("", WpfRootNs)); return(xamlNamespaceRegistry); }
private static NamespaceRegistry CreateXamlNamespaceRegistry() { var xamlNamespaceRegistry = new NamespaceRegistry(); var windowType = typeof (Window); var textBlockType = typeof (TextBlock); var toggleButtonType = typeof (ToggleButton); var rotateTransformType = typeof (RotateTransform); var bindingType = typeof (BindingExtension); var rootNs = XamlNamespace.Map(WpfRootNs) .With( new[] { Route.Assembly(bindingType.Assembly).WithNamespaces( new[] {bindingType.Namespace}), Route.Assembly(rotateTransformType.Assembly).WithNamespaces( new[] {rotateTransformType.Namespace}), Route.Assembly(bindingType.Assembly).WithNamespaces( new[] {bindingType.Namespace}), Route.Assembly(windowType.Assembly).WithNamespaces( new[] { windowType.Namespace, textBlockType.Namespace, toggleButtonType.Namespace }) }); foreach (var ns in new List<XamlNamespace> {rootNs}) { xamlNamespaceRegistry.AddNamespace(ns); } xamlNamespaceRegistry.RegisterPrefix(new PrefixRegistration("", WpfRootNs)); return xamlNamespaceRegistry; }