첨부 실행 코드는 나눔고딕코딩 폰트를 사용합니다.
728x90
반응형
728x170

▶ XAML

<Grid x:Name="grid"
    Width="400"
    Height="300">
    <Grid.Resources>
        <!-- "IValueConverter 인터페이스 : 일시→문자열 값 변환자 구현하기" 참조 -->
        <local:DateTimeToStringValueConverter x:Key="DateTimeToStringValueConverterKey" />
    </Grid.Resources>
    <Rectangle Stroke="Black">
        <Rectangle.Fill>
            <LinearGradientBrush
                StartPoint="0.5 0"
                EndPoint="0.5 1">
                <GradientStop Color="#FF00004F" Offset="0" />
                <GradientStop Color="#FF00408C" Offset="1" />
            </LinearGradientBrush>
        </Rectangle.Fill>
    </Rectangle>
    <TextBlock
        VerticalAlignment="Center"
        HorizontalAlignment="Center"
        Foreground="White"
        FontWeight="Bold"
        FontSize="20"
        Text="{Binding Path=Value, Mode=OneWay, Converter={StaticResource DateTimeToStringValueConverterKey}, ConverterParameter=yyyy-MM-dd}" />
</Grid>

 

728x90

 

▶ C#

using System;

DateTimeModel dateTimeModel = new DateTimeModel(); // "INotifyPropertyChanged 인터페이스 구현하기" 참조

dateTimeModel.Value = DateTime.Now;

this.grid.DataContext = dateTimeModel;

 

728x90
반응형
그리드형(광고전용)
Posted by icodebroker

댓글을 달아 주세요