본문 바로가기

Development/WPF

[WPF] TextBox 가운데 정렬

반응형
환경 : Visaul Studio 2015

알면 별거 아닌데 이놈의 Property ...

TextBox를 Grid 안에 넣고 Build 를 해서 실행 했더니 내가 생각한 느낌이 아니다. ㅋㅋ

확실히 Winform과는 다른 Perperty 들이 너무 많아 졌다.

이번에는 Layout Grid 안에 Textbox를 이쁘게(?) 넣는, 즉 가로 세로 가운데 정렬 Property 를 설정 하려 한다.

<TextBox x:Name="textBox" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" VerticalContentAlignment="Center" Grid.Row="2" Grid.Column="1" Margin="5"></TextBox>

HorizontalAlignment : 가로 정렬 [Center, Left, Rigth, Stretch]

VerticalAlignment : 세로 정렬 [Center, Top, Bottom, Stretch]

VerticalContentAlignment : Textbox의 Text 세로 정렬 [Center, Top, Bottom, Stretch]

 

TextBox Class [MSDN]

 

TextBox Class (System.Windows.Controls)

서식 없는 텍스트를 표시하거나 편집하는 데 사용할 수 있는 컨트롤을 나타냅니다.Represents a control that can be used to display or edit unformatted text.

docs.microsoft.com

 

반응형

'Development > WPF' 카테고리의 다른 글

[WPF] Watermark TextBox 만들기 (Resource)  (1) 2020.12.10
[WPF] DataGrid 에서 Rows Count  (0) 2020.07.13
[WPF] NotifyTrayIcon  (0) 2020.07.09
[WPF] Combobox Object Binding  (0) 2020.07.02
[WPF] Application 종료 시 Show Popup 종료  (0) 2020.07.02