개발/WPF
[WPF] WPF 시작
귀뚜래미
2022. 8. 30. 15:47
WPF가 무엇인지, WinForm과의 비교 등등 잡다한 것 생략하고 필요한 부분만 요약해서 정리
01. WPF 프로젝트 생성
새롭게 생성된 프로젝트에는 몇가지 파일들이 포함된다. 프로젝트가 시작되면 특별히 개발자가 변형하지 않는 한 기본 윈도우가 첫 번째로 나타난다. 이 안의 기본적으로 생성된 XAML 코드(MainWindow.xaml)는 다음과 같다.
<Window x:Class="HelloWPF.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="350" Width="525">
<Grid>
</Grid>
</Window>
간단한 TextBlock 컨트롤을 Grid 패널에 추가한다.
<Window x:Class="WpfApplication1.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="350" Width="525">
<Grid>
<TextBlock HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="72">
Hello, WPF!
</TextBlock>
</Grid>
</Window>
반응형