[C#/WPF] Application 클래스 : GetRemoteStream 정적 메소드를 사용해 원본 사이트 파일 XAML 페이지 로드하기
C#/WPF 2022. 1. 2. 23:35728x90
반응형
728x170
▶ RemotePage.xaml
<Page
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
Title="원본 사이트 파일 페이지">
<Grid>
<Ellipse
Margin="50"
Fill="RoyalBlue" />
</Grid>
</Page>
728x90
▶ 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="Application 클래스 : GetRemoteStream 정적 메소드를 사용해 원본 사이트 파일 XAML 페이지 로드하기"
FontFamily="나눔고딕코딩"
FontSize="16">
<Frame Name="frame"
Margin="10"
BorderThickness="1"
BorderBrush="Black" />
</Window>
반응형
▶ MainWindow.xaml.cs
using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Markup;
using System.Windows.Resources;
namespace TestProject
{
/// <summary>
/// 메인 윈도우
/// </summary>
public partial class MainWindow : Window
{
//////////////////////////////////////////////////////////////////////////////////////////////////// Constructor
////////////////////////////////////////////////////////////////////////////////////////// Public
#region 생성자 - MainWindow()
/// <summary>
/// 생성자
/// </summary>
public MainWindow()
{
InitializeComponent();
Uri uri = new Uri("/PAGE/RemotePage.xaml", UriKind.Relative);
//Uri uri = new Uri("pack://siteoforigin:,,,/PAGE/RemotePage.xaml", UriKind.Absolute);
StreamResourceInfo info = Application.GetRemoteStream(uri);
XamlReader reader = new XamlReader();
Page page = (Page)reader.LoadAsync(info.Stream);
this.frame.Content = page;
}
#endregion
}
}
728x90
반응형
그리드형(광고전용)
'C# > WPF' 카테고리의 다른 글
[C#/WPF] DoubleAnimation 클래스 : 화면을 반짝이는 애니메이션 사용하기 (0) | 2022.01.09 |
---|---|
[C#/WPF] TextBox 클래스 : KeyDown 이벤트를 사용해 ENTER 키를 누르는 경우 포커스 해제하기 (0) | 2022.01.08 |
[C#/WPF] 마이크로폰 볼륨 설정하기 (0) | 2022.01.08 |
[C#/WPF] 정렬과 필터링 가능한 데이터 가상화 사용하기 (0) | 2022.01.06 |
[C#/WPF] Page 엘리먼트 : WindowWidth/WindowHeight/WindowTitle 속성 사용하기 (0) | 2022.01.04 |
[C#/WPF] 원본 사이트 파일 사용하기 (0) | 2022.01.02 |
[C#/WPF] Frame 엘리먼트 : Source 속성을 사용해 컨텐트 XAML 페이지 로드하기 (0) | 2022.01.02 |
[C#/WPF] Frame 클래스 : Source 속성을 사용해 컨텐트 XAML 페이지 로드하기 (0) | 2022.01.02 |
[C#/WPF] Application 클래스 : GetContentStream 정적 메소드를 사용해 컨텐트 XAML 페이지 로드하기 (0) | 2022.01.02 |
[C#/WPF] Frame 엘리먼트 : Source 속성을 사용해 리소스 XAML 페이지 로드하기 (0) | 2022.01.02 |
댓글을 달아 주세요