는 .NET 4로 작업하는 경우, 왜 두 가지 옵션을 결합 App.config
내부 XAML을 넣지?
namespace SomeNamespace
{
public class SomeType
{
public SomeType() { … } // XAML requires a parameterless constructor
…
}
}
마지막의 인스턴스를 검색 : 당신이 유형을 가지고 제공
<configSections>
<section name="SomeType" type="XamlConfigurationSection, …" />
</configSections>
<SomeType xmlns="clr-namespace:SomeNamespace;assembly=…"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
…
</SomeType>
:
using System.Configuration;
using System.Xaml;
using System.Xml;
public class XamlConfigurationSection : IConfigurationSectionHandler
{
public object Create(object parent, object configContext, XmlNode section)
{
return XamlServices.Parse(section.OuterXml);
}
}
이 사용자 지정 구성 섹션은 App.config
에서 XAML로 설명 개체를 포함 할 수 있습니다 이 유형은 App.config
이고 :
+1 config에 Xaml을 사용하는 재미있는 아이디어가 있습니다. – AnthonyWJones
Jebrains Resharper 2016.1이 xaml을 사용하여 솔루션 설정을 * .DotSettings.User 파일에 저장하는 것으로 나타났습니다. 위대한 마음 ... –