Grid使用 & ComboBox Binding & DateTime Format WPF

Grid使用

 <Grid AllowDrop="False" Height="368" Loaded="window_load" VerticalAlignment="Top">
        <Grid.RowDefinitions>
            <RowDefinition Height="23"/>
            <RowDefinition Height="140"/>
            <RowDefinition Height="5"/>
            <RowDefinition Height="40"/>
            <RowDefinition Height="40"/>
            <RowDefinition Height="40"/>
            <RowDefinition Height="50"/>
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="150" />
            <ColumnDefinition Width="*"/>
        </Grid.ColumnDefinitions>

 <Label Content="Club" Height="28" HorizontalAlignment="Right"  Name="lblClub" VerticalAlignment="Center" Grid.Row="1" Grid.Column="0" />
<ComboBox Height="23" HorizontalAlignment="Left"  Name="cBoxClub" VerticalAlignment="Center" Width="120" Grid.Column="1" Grid.Row="1" />

</Grid>

 

ComboBox Binding

 <ComboBox Height="23" HorizontalAlignment="Left"  Name="cBoxClub" VerticalAlignment="Center" Width="120" Grid.Column="1" Grid.Row="3" />

 

            cBoxClub.ItemsSource = listNote;
            cBoxClub.DisplayMemberPath = "Club";
            cBoxClub.SelectedValuePath = "Club";
            cBoxClub.SelectedValue = "AAA";

 

 DateTime Format   

<TextBlock.Text>
        <Binding Path="ExpiryDate" StringFormat="MM/dd/yyyy"/>
</TextBlock.Text>

or 

txtExpieyDate.Text = calDate.SelectedDate.Value.ToShortDateString();

or

 

posted @ 2012-10-17 14:12  璎Nicole珞  阅读(388)  评论(0编辑  收藏  举报