WPF 응용 프로그램에서 XmlnsDefinitions를 만들어 다른 어셈블리의 여러 네임 스페이스를 하나의 참조로 매핑 할 수 있습니다.WPF XAML 기본 네임 스페이스 정의를 병합
당신은 예를 들어, 마이크로 소프트의 기본 XmlnsDefinition에 자신의 네임 스페이스를 매핑하는 것을 활용할 수 있습니다
[assembly: XmlnsDefinition("http://schemas.microsoft.com/winfx/2006/xaml/presentation", "MyLibrary.MyControls")]
이 방법은, 당신도 XAML에 네임 스페이스에 대한 참조를 추가 할 필요가 없습니다 왜냐하면 그들은 이미 기본 "xmlns"에 매핑되어 있기 때문입니다.
이<MyControl />
내 질문이입니다 : 내가 기본 Microsoft 네임 스페이스가 병합 할 수 나는 "MyControl"라는 컨트롤이 있다면
그래서, 나는 (모든 네임 스페이스 또는 접두사없이)과 같이 사용할 수 있습니다 하나 하나로?
예 : "xmlns : x"네임 스페이스를 "xmlns"에 병합하여 제거하고자합니다. "http://schemas.microsoft.com/winfx/2006/xaml"의 모든 네임 스페이스를 "http://schemas.microsoft.com/winfx/2006/xaml/presentation"으로 참조해야합니다. 이처럼
:
[assembly: XmlnsDefinition("http://schemas.microsoft.com/winfx/2006/xaml/presentation", "System...")]
[assembly: XmlnsDefinition("http://schemas.microsoft.com/winfx/2006/xaml/presentation", "System...")]
...
그래서 나는이를 설정할 수 있습니다 :
<Window x:Class="MyProject.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
>
을이 속으로 :
<Window Class="MyProject.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
>
중복 : https://stackoverflow.com/questions/47427705/c-sharp-xml-writer-format-amazonenvelope-for-au-scratchpad#comment81843968_47427705. 문자열 innerxml = "xsi : noNamespaceSchemaLocation = \"amzn-envelope.xsd \ "xmlns : xsi = \"w3.org/2001/XMLSchema-instance \ ""; using (var writer = XmlWriter.Create (stream, settings)) {writer.WriteStartElement ("AmazonEnvelope"); writer.WriteRaw (innerxml); writer.WriteEndElement(); } – jdweng
그 질문은 내 것과 관련이 없습니다. –