첨부 소스 코드는 나눔고딕코딩 폰트를 사용합니다.
728x90
반응형
728x170
using System;
using System.Text;
using System.Windows;
using System.Windows.Markup;
using System.Xml;

#region XAML 구하기 - GetXAML(template)

/// <summary>
/// XAML 구하기
/// </summary>
/// <param name="template">프레임워크 템플리트</param>
/// <returns>XAML</returns>
public string GetXAML(FrameworkTemplate template)
{
    XmlWriterSettings setting = new XmlWriterSettings();

    setting.Indent              = true;
    setting.IndentChars         = new string(' ', 4);
    setting.NewLineOnAttributes = true;

    StringBuilder stringBuilder = new StringBuilder();

    XmlWriter writer = XmlWriter.Create(stringBuilder, setting);

    try
    {
        XamlWriter.Save(template, writer);
    }
    catch(Exception)
    {
        return string.Empty;
    }

    return stringBuilder.ToString();
}

#endregion
728x90
반응형
그리드형(광고전용)
Posted by icodebroker

댓글을 달아 주세요