微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

使用Silverlight2dataGrid例子(完整XAML)

  1.  <data:DataGrid x:Name="results" RowHeight="60" IsReadOnly="True" Width="800" Margin="14"
  2.       RowBackground="#99FFFFFF" AlternatingRowBackground="#66FFFFFF"
  3.       HeadersVisibility="None" GridlinesVisibility="Horizontal"             
  4.       RowDetailsVisibility="VisibleWhenSelected" SelectionMode="SingleFullRow">
  5.       <data:DataGrid.Columns>
  6.         <data:DataGridTemplateColumn Width="80">
  7.           <data:DataGridTemplateColumn.CellTemplate>
  8.             <DataTemplate>
  9.               <Border CornerRadius="5" BorderThickness="1" Margin="5" BorderBrush="DarkGray" Background="Black">
  10.                 <Image Source="{Binding ImageUrl}" Stretch="UniformToFill" Margin="1"/>
  11.               </Border>
  12.             </DataTemplate>
  13.           </data:DataGridTemplateColumn.CellTemplate>
  14.         </data:DataGridTemplateColumn>
  15.           
  16.         <data:DataGridTextBoxColumn displayMemberBinding="{Binding Title}" FontSize="20" FontWeight="Bold" Width="527"/>
  17.           
  18.         <data:DataGridTemplateColumn Width="165">
  19.           <data:DataGridTemplateColumn.CellTemplate>
  20.             <DataTemplate>
  21.               <StackPanel VerticalAlignment="Center">
  22.                 <TextBlock Text="Source" Foreground="#666666" FontWeight="Bold" FontFamily="Trebuchet MS" FontSize="14"/>
  23.                 <TextBlock Text="{Binding Source}" FontFamily="Trebuchet MS" FontSize="14"/>
  24.               </StackPanel>
  25.             </DataTemplate>
  26.           </data:DataGridTemplateColumn.CellTemplate>
  27.         </data:DataGridTemplateColumn> 
  28.       </data:DataGrid.Columns>
  29.       
  30.       <data:DataGrid.RowDetailstemplate>
  31.         <DataTemplate>
  32.           <!-- MouseLeave -->
  33.           <Grid Margin="5,5,0" Background="Transparent">
  34.             <Grid.ColumnDeFinitions>
  35.               <ColumnDeFinition />
  36.               <ColumnDeFinition Width="Auto"/>
  37.             </Grid.ColumnDeFinitions>
  38.               
  39.             <Grid.RowDeFinitions>
  40.               <RowDeFinition Height="Auto"/>                            
  41.               <RowDeFinition Height="10" />
  42.             </Grid.RowDeFinitions>
  43.               
  44.             <StackPanel>
  45.               <TextBlock Text="{Binding Description}" textwrapping="Wrap" Margin="5" FontFamily="Trebuchet MS" FontSize="16"/>
  46.               <TextBlock Text="Posted On:" Foreground="#666666" Margin="5,0" FontFamily="Trebuchet MS" FontSize="14" FontWeight="Bold"/>
  47.               <TextBlock Text="{Binding PublishDate}" Margin="5,5" FontFamily="Trebuchet MS" FontSize="14"/>
  48.               <TextBlock Text="View Count:" Foreground="#666666" Margin="5,0" FontFamily="Trebuchet MS" FontSize="14" FontWeight="Bold"/>
  49.               <TextBlock Text="{Binding ViewCount}" Margin="5,5" FontFamily="Trebuchet MS" FontSize="14"/>
  50.             </StackPanel>
  51.             <Border Grid.Column="1" Height="330" Width="440" CornerRadius="5" BorderThickness="1" Margin="5" BorderBrush="DarkGray" Background="Black" VerticalAlignment="Top">
  52.               <Grid>
  53.                 <MediaElement Margin="2" Source="{Binding VideoUrl}" Autoplay="True"/>
  54.                 <Button Content="Play" Width="50" Height="50" Margin="0,35" Opacity="0"/>
  55.               </Grid>
  56.             </Border>
  57.           </Grid>
  58.         </DataTemplate>
  59.       </data:DataGrid.RowDetailstemplate>
  60.     </data:DataGrid>

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐