CHEAT SHEET
Border : 경계선
Rectangle : 사각형, 내부에 Rectangle.Fill을 통해 색 지정가능.
<Border Grid.Row="2" Width="800" CornerRadius="10" BorderThickness="5">
<Border.BorderBrush>
// 외곽 칠하기
<LinearGradientBrush StartPoint="0,0" EndPoint="1,0">
<GradientStop Color="#ec2075" Offset="0.0" />
<GradientStop Color="#f33944" Offset="0.50" />
</LinearGradientBrush>
</Border.BorderBrush>
<Rectangle>
<Rectangle.Fill>
// 사각형 채우기
<LinearGradientBrush StartPoint="0, 0" EndPoint="1, 0">
// 그라디언트 채우기, 시작점과 끝점의 설정 필요
// 0, 0 : 왼쪽 위 // 1, 0 : 오른쪽 위
<GradientStop Color="#ec2075" Offset="0.0"/>
// 그라디언트 시작점
<GradientStop Color="#f33944" Offset="0.5"/>
// 그라디언트 끝점
// Offset : 위 Stop이 적용되는 지점 ( 0.0 ~ 1.0 )
</LinearGradientBrush>
</Rectangle.Fill>
</Rectangle>
</Border>
ComboBox : 정해진 몇개의 값을 고를수 있도록 함
Window
- WindowStartupLocation : 프로그램이 실행 될 때 어디에서 실행될지를 정할수 있다.
- SizeToContent : 화면의 크기를 자동으로 설정하게 할수 있다.
ComboBox 값 지정하기
DataTable dtCurrency = new DataTable();
// ComboBox에 들어갈 데이터 - DataTable
dtCurrency.Columns.Add("Text");
dtCurrency.Columns.Add("Value");
// Column 이름 지정하기 ( Text, Value )
// 각각의 Column에 맞는 값 지정하기
dtCurrency.Rows.Add("--SELECT--", 0);
dtCurrency.Rows.Add("INR", 1);
dtCurrency.Rows.Add("USD", 75);
dtCurrency.Rows.Add("EUR", 85);
dtCurrency.Rows.Add("SAR", 20);
dtCurrency.Rows.Add("POUND", 5);
dtCurrency.Rows.Add("DEM", 43);
cmbFromCurrency.ItemsSource = dtCurrency.DefaultView;
// Key / Value 지정
cmbFromCurrency.DisplayMemberPath = "Text";
cmbFromCurrency.SelectedValuePath = "Value";
입력값 Validation
- PreviewTextInput 이벤트를 사용한다.
private void NumberValidationTextBox(object sender, TextCompositionEventArgs e)
{
Regex regex = new Regex("^[0-9]+");
// 값을 검사할 Regular Expression 설정
e.Handled = !regex.IsMatch(e.Text);
// e.Handled 의 값이 true일 경우, 값이 입력되지 않음
// e.Handled 의 값이 false일 경우, 값이 입력됨
}