728x90
반응형
728x170
▶ MainWindow.xaml
<Window x:Class="TestProject.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Width="800"
Height="600"
Title="XamlReader 클래스 : Load 정적 메소드를 사용해 리소스 형태의 XAML 파일 로드하기"
FontFamily="나눔고딕코딩"
FontSize="16">
<Grid Margin="10">
<Border
BorderBrush="Black"
BorderThickness="1">
<FlowDocumentScrollViewer Name="viewer" />
</Border>
</Grid>
</Window>
728x90
▶ MainWindow.xaml.cs
using System;
using System.IO;
using System.Windows;
using System.Windows.Documents;
using System.Windows.Markup;
namespace TestProject
{
/// <summary>
/// 메인 윈도우
/// </summary>
public partial class MainWindow : Window
{
//////////////////////////////////////////////////////////////////////////////////////////////////// Constructor
////////////////////////////////////////////////////////////////////////////////////////// Public
#region 생성자 - MainWindow()
/// <summary>
/// 생성자
/// </summary>
public MainWindow()
{
InitializeComponent();
Uri uri = new Uri("pack://application:,,,/Help.xaml");
Stream stream = Application.GetResourceStream(uri).Stream;
FlowDocument document = XamlReader.Load(stream) as FlowDocument;
this.viewer.Document = document;
}
#endregion
}
}
728x90
반응형
그리드형(광고전용)
'C# > WPF' 카테고리의 다른 글
[C#/WPF] 속성을 정의하지 않은 엘리먼트에서 클래스명과 속성명을 포함하는 속성 사용하기 (0) | 2020.08.21 |
---|---|
[C#/WPF] ContentPropertyAttribute 클래스 : 컨텐트 속성 사용하기 (0) | 2020.08.21 |
[C#/WPF] XmlnsDefinitionAttribute 클래스 : XmlNamsapce/ClrNamespace 속성을 사용해 XML 네임스페이스와 CLR 네임스페이스 매핑하기 (0) | 2020.08.21 |
[C#/WPF] Frame 엘리먼트 : Source 속성을 사용해 리소스 형태의 XAML 파일 로드하기 (0) | 2020.08.20 |
[C#/WPF] Frame 클래스 : Source 속성을 사용해 리소스 형태의 XAML 파일 로드하기 (0) | 2020.08.20 |
[C#/WPF] Frame 엘리먼트 : NavigationUIVisibility 속성 사용하기 (0) | 2020.08.20 |
[C#/WPF] x:Code 엘리먼트 : XAML 파일에서 코드 내장하기 (0) | 2020.08.20 |
[C#/WPF] XAML 문자열에서 객체 생성하기 (0) | 2020.08.20 |
[C#/WPF] KeyGesture 클래스 : 단축 키 사용하기 (0) | 2020.08.19 |
[C#/WPF] DocumentPaginator 클래스 : 일반 텍스트 문자열 출력하기 (0) | 2020.08.19 |
댓글을 달아 주세요