<UserControl xmlns:data="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data" xmlns:basics="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls" x:Class="SilverLightCityGas.BMA_SD_005"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Width="552" Height="352" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" Background="#FF797979">
<Grid x:Name="LayoutRoot" Background="#FFA4A4A4" ShowGridLines="True">
<StackPanel Margin="10,10,10,10">
<TextBlock Text="DataGrid Demonstration" Margin="0,20,10,20"
FontFamily="Verdana" FontSize="18" FontWeight="Bold"
Foreground="#FF5C9AC9" />
<TextBlock Text="DataGrid with autogenerated columns:"/>
<data:DataGrid x:Name="dataGrid1"
Height="140" Margin="0,5,0,10"
AutoGenerateColumns="True" />
<TextBlock Text="DataGrid with row details sections:"/>
<data:DataGrid x:Name="dataGrid3"
Height="140" Margin="0,5,0,10"
RowDetailsVisibilityMode="VisibleWhenSelected" >
<data:DataGrid.RowDetailsTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<TextBlock FontSize="12" Text="Address: " />
<TextBlock FontSize="12" Text="{Binding Address}"/>
</StackPanel>
</DataTemplate>
</data:DataGrid.RowDetailsTemplate>
</data:DataGrid>
<TextBlock Text="DataGrid with configured columns:"/>
<data:DataGrid x:Name="dataGrid4"
Height="160" Margin="0,5,0,10"
RowHeight="40" AutoGenerateColumns="False" >
<data:DataGrid.Columns>
<data:DataGridTextColumn
Header="First Name"
Width="SizeToHeader"
Binding="{Binding FirstName}"
FontSize="20" />
<data:DataGridTextColumn
Header="Last Name"
Width="SizeToCells"
Binding="{Binding LastName}"
FontSize="20" />
<data:DataGridTextColumn
Header="Address"
Width="150"
Binding="{Binding Address}" >
<data:DataGridTextColumn.ElementStyle>
<Style TargetType="TextBlock">
<Setter Property="TextWrapping" Value="Wrap"/>
</Style>
</data:DataGridTextColumn.ElementStyle>
<data:DataGridTextColumn.EditingElementStyle>
<Style TargetType="TextBox">
<Setter Property="Foreground" Value="Blue"/>
</Style>
</data:DataGridTextColumn.EditingElementStyle>
</data:DataGridTextColumn>
<data:DataGridCheckBoxColumn
Header="New?"
Width="40"
Binding="{Binding IsNew}" />
<data:DataGridCheckBoxColumn
Header="Subscribed?"
Width="Auto"
Binding="{Binding IsSubscribed}"
IsThreeState="True" />
</data:DataGrid.Columns>
</data:DataGrid>
<TextBlock Text="DataGrid with template column and custom alternating row backgrounds:"/>
<data:DataGrid x:Name="dataGrid5"
Height="125" Margin="0,5,0,10"
AutoGenerateColumns="False"
RowBackground="Azure"
AlternatingRowBackground="LightSteelBlue">
<data:DataGrid.Columns>
<!-- Name Column -->
<data:DataGridTemplateColumn Header="Name">
<data:DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<TextBlock Padding="5,0,5,0"
Text="{Binding FirstName}"/>
<TextBlock Text="{Binding LastName}"/>
</StackPanel>
</DataTemplate>
</data:DataGridTemplateColumn.CellTemplate>
<data:DataGridTemplateColumn.CellEditingTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<TextBox Padding="5,0,5,0"
Text="{Binding FirstName}"/>
<TextBox Text="{Binding LastName}"/>
</StackPanel>
</DataTemplate>
</data:DataGridTemplateColumn.CellEditingTemplate>
</data:DataGridTemplateColumn>
<!-- Address Column -->
<data:DataGridTextColumn
Header="Address" Width="300"
Binding="{Binding Address}" />
</data:DataGrid.Columns>
</data:DataGrid>
</StackPanel>
</Grid>
</UserControl>
'WPF' 카테고리의 다른 글
실버라이트로 windows mobile 7 프로그램 개발 (0) | 2010.03.17 |
---|---|
태그삭제 Convert (0) | 2010.01.02 |
ObservableCollection<(Of <(T>)>) Class (0) | 2010.01.02 |
INotifyPropertyChanged (0) | 2010.01.02 |
Using Value Converters (0) | 2010.01.02 |
간단한 data grid 사용법 (0) | 2010.01.02 |
쿠키사용법 (0) | 2009.12.15 |
웹 페이지에 Silverlight 추가 (0) | 2009.12.15 |
간단하게 세션처럼 사용하기?! (0) | 2009.12.15 |
WCF 웹서비스를 이용한 데이터 바인딩 (0) | 2009.12.15 |