728x90
1. 프로젝트 생성하기
2. 구성도
◾ 솔루션 구조
- 현재 작업중인 UI 표시 영역
- 마우스를 이용한 이동, 크기 변경 등의 편집 작업 가능
- 컨트롤 + 마우스 휠을 통해 UI화면을 확대 / 축소 보기 가능
◾ XAML 에디터
- 실제로 코딩 하는 영역
- XML을 기반으로 하기 때문에 트리구조를 가짐.
태그를 정의하는 방식 - Window라는 최상위 태그가 있고 그 내부에 Grid라는 하위 태그를 가지고 있다.
Window 태그에서는 Height, Title 등 다수의 속성을 가지고 있다. - XAML 에디터나 WPF 디자이너를 통해 컨트롤을 추가하는 경우, Grid 태그 아래에 태그가 추가된다.
//만약 네임스페이스나 클래스명을 변경하는 경우 반드시 x:Class 부분도 수정해야함.
<Window x:Class="WpfApp1.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:WpfApp1"
mc:Ignorable="d"
Title="MainWindow" Height="450" Width="800">
<Grid>
</Grid>
</Window>
◾ 솔루션 구조
- MainWindow.xaml : XML을 통해 실제 UI 작업을 하는 파일
- MainWindow.xaml.cs : cs파일을 이용해 UI와 연동하여 이벤트, 속성, 메서드 등을 코딩
- App.xaml : 어플리케이션 정의 파일
어플리케이션 실행 시 MainWindow.xaml 혹은 MainWindow.xaml.cs 파일이 먼저 실행 됨.
MainWindow.xaml 파일에 정의된 StartupURI 속성에 의해 어플리케이션 실행 시 윈도우가 뜸.
<Application x:Class="WpfApp1.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:WpfApp1"
//실행 시 윈도우가 뜨는 이유
StartupUri="MainWindow.xaml">
<Application.Resources>
</Application.Resources>
</Application>
728x90
'C# > C# WPF 개념' 카테고리의 다른 글
[C# WPF] 바인딩 #01 - 바인딩의 개념 (0) | 2023.08.17 |
---|---|
[C# WPF] UI 만들기 #03 - 간단한 UI만들어보기 (0) | 2023.08.17 |
[C# WPF] UI 만들기 #02 - WPF컨트롤, 공통 속성, 속성, 컨트롤 변경 (0) | 2023.08.17 |
[C# WPF] UI 만들기 #01 - 컨트롤 추가, Content, 레이아웃 (0) | 2023.08.17 |
[C# WPF] WPF란? (0) | 2023.08.17 |