목록WPF/XAML조각모음 (6)
하아찡
이번 글은 이전글에서 Xaml에서 Binding을 사용해서 가져왔던 cs 코드 입니다. CustomTitleBar.cs 코드 입니다. using Prism.Commands; using System.Windows; using System.Windows.Controls; using System.Windows.Input; using System.Windows.Media; namespace TitleBar.Themas.ResourceClass { internal class CustomTitleBar : UserControl { //기본 타이틀바 넓이 private static int TitleBarWidth = 50; private int iconWidth = 30; #region 의존성속성 값 //배경색 및 ..

기존 타이틀바 말고 새롭게 커스텀 하고싶어서 만들어 봤습니다. 결과물 현재까지 구현한 기능은 아이콘 추가, 타이틀명, 최소화, 최대화, 폼 종료까지 구현했습니다. Window Xaml 코드입니다. 기존에 있는 Titlebar를 지우기위해 WindowStyle="None" 을 추가하여 기본으로 제공하는 Titlebar를 제거 했습니다. CustomControl 이름은 CustomTitleBar라고 작업을 진행 했습니다. CustomTitleBar.Xaml 코드 입니다. 첫번째 x:key="Btns"는 CustomTitleBar에서 최소화, 최대화, 닫기를 모두 버튼을 사용하여 만들어서 스타일 한 개를 만들어 추가하는 방식으로 사용했습니다. 해당 스타일에는 기본적인 배경색, 폰트색상, 호버됐을때 배경색변경하..
1편과 2편에서 셋팅한걸 이제 불러다 사용합니다. MainWindow.xaml쪽 코드입니다. 코드를 업로드하기위해서 프로젝트를 다시 생성해서 이전과 다른 부분들이 있습니다. 내가 만든 클래스를 rclass로 등록 후 사용했습니다. xmlns:rclass="clr-namespace:TextBoxPlaceHolder.Themas.CustomControls.ResourceClass" 이제 컨트롤을 불러다 사용하는데 DependencyProperty(의존성 속성)으로 등록한 변수값을 컨트를을 호출할때 값을 전달해줄 수 있습니다. TextValue에는 아무런 값을 전달해주지 않아 Textbox에 값이 존재하지 않는상태로 시작하게 설정했습니다. PlaceHolder에는 워터마크로 사용할 TextBlock에 값을 설..
아래 코드는 Xaml Style 전체 입니다. 현재 리소스사전 타겟 타입을 1편에서 소개했던 CustomTextbox.cs 로 등록해줍니다. x:Name 이부분은 해당 컨트롤 이름을 정해줘서 Xaml안에서 해당 이름으로 컨트롤을 찾아낼 수 있습니다. MVC패턴에선 해당 이름을가지고 코드에서도 사용 할 수 있습니다. Text="{TemplateBinding TextValue}" 이부분은 1편에서 CustomTextbox.cs에서 지정해줬던 변수를 바인딩시켜줘서 Xaml과 CustomTextbox를 서로 연결시켜줍니다. 이부분은 TextBox 스타일값을 설정하기 위해서 열어줍니다. Text="{TemplateBinding PlaceHolder}" 이부분은 1편에서 CustomTextbox.cs에서 지정해줬던..

일단 기본적인 개념은 아래 사이트에서 공부해보시면 생각보다 좋은내용들이 있습니다. https://www.tutorialspoint.com/xaml/index.htm XAML Tutorial XAML Tutorial - Welcome to the XAML tutorial for beginners. This tutorial puts greater emphasis on realtime implementation of the concept rather than discussing just the theory part. The primary objective of this tutorial is to provide you a better underst www.tutorialspoint.com 원하는 구성 TextB..