Advertisement
Guest User

Untitled

a guest
Oct 5th, 2013
2,005
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.91 KB | None | 0 0
  1. XAML:
  2.  
  3. <Window x:Class="MiscSamples.KanBanSample"
  4. xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  5. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  6. Title="KanBanSample" Height="670" Width="1225">
  7. <Window.Resources>
  8. <DataTemplate x:Key="InnerTemplate">
  9. <Grid Margin="10" MaxHeight="100" MaxWidth="100">
  10. <Path Data="M0.5,1 L1,68.5 56.25,68.25 68,55.5 68,0.5 z M56.375,68.281 L57.75,57.75 M68.25,55.25 L57.405993,58.203003"
  11. Fill="#FFF4F4F5" Stroke="#3C5B8A" Stretch="Uniform"/>
  12.  
  13. <TextBlock Text="{Binding DisplayName}"
  14. FontSize="20" VerticalAlignment="Center" HorizontalAlignment="Center"/>
  15. </Grid>
  16. </DataTemplate>
  17.  
  18. <DataTemplate x:Key="OuterTemplate">
  19. <Grid Margin="2" MaxWidth="300">
  20. <Grid.RowDefinitions>
  21. <RowDefinition Height="Auto" SharedSizeGroup="Header"/>
  22. <RowDefinition/>
  23. </Grid.RowDefinitions>
  24.  
  25. <Border BorderThickness="1" BorderBrush="#6388B4">
  26. <Border.Background>
  27. <LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
  28. <GradientStop Color="#88D1FF" Offset="0"/>
  29. <GradientStop Color="#88D1FF" Offset=".1"/>
  30. <GradientStop Color="#4586D6" Offset="1"/>
  31. </LinearGradientBrush>
  32. </Border.Background>
  33.  
  34. <TextBlock Text="{Binding DisplayName}"
  35. FontSize="20" Foreground="White" Margin="10" TextWrapping="Wrap"
  36. TextAlignment="Center"/>
  37. </Border>
  38.  
  39. <Border BorderBrush="#6B86A4" BorderThickness="1" Background="#CDD3E1" Grid.Row="1" Margin="0,5,0,0">
  40. <ItemsControl ItemsSource="{Binding Items}" Margin="10"
  41. ItemTemplate="{StaticResource InnerTemplate}">
  42. <ItemsControl.ItemsPanel>
  43. <ItemsPanelTemplate>
  44. <WrapPanel/>
  45. </ItemsPanelTemplate>
  46. </ItemsControl.ItemsPanel>
  47. </ItemsControl>
  48. </Border>
  49.  
  50. </Grid>
  51. </DataTemplate>
  52. </Window.Resources>
  53.  
  54. <ItemsControl ItemsSource="{Binding}" ItemTemplate="{StaticResource OuterTemplate}"
  55. Grid.IsSharedSizeScope="True">
  56. <ItemsControl.ItemsPanel>
  57. <ItemsPanelTemplate>
  58. <VirtualizingStackPanel Orientation="Horizontal"/>
  59. </ItemsPanelTemplate>
  60. </ItemsControl.ItemsPanel>
  61. </ItemsControl>
  62. </Window>
  63.  
  64. Code Behind:
  65.  
  66. public partial class KanBanSample : Window
  67. {
  68. public KanBanSample()
  69. {
  70. InitializeComponent();
  71.  
  72. DataContext = new List<KanBanSampleOuterItem>
  73. {
  74. new KanBanSampleOuterItem()
  75. {
  76. DisplayName = "PETICION DE TAREAS",
  77. Items =
  78. {
  79. new KanBanSampleInnerItem("M"),
  80. new KanBanSampleInnerItem("N"),
  81. }
  82. },
  83. new KanBanSampleOuterItem()
  84. {
  85. DisplayName = "SELECCION DE TAREAS (5)",
  86. Items =
  87. {
  88. new KanBanSampleInnerItem("H"),
  89. new KanBanSampleInnerItem("I"),
  90. new KanBanSampleInnerItem("J"),
  91. new KanBanSampleInnerItem("K"),
  92. new KanBanSampleInnerItem("L"),
  93. }
  94. },
  95. new KanBanSampleOuterItem()
  96. {
  97. DisplayName = "DESARROLLO (4)",
  98. Items =
  99. {
  100. new KanBanSampleInnerItem("D"),
  101. new KanBanSampleInnerItem("E"),
  102. new KanBanSampleInnerItem("F"),
  103. new KanBanSampleInnerItem("G"),
  104. }
  105. },
  106. new KanBanSampleOuterItem()
  107. {
  108. DisplayName = "PRUEBA (1)",
  109. Items =
  110. {
  111. new KanBanSampleInnerItem("C"),
  112. }
  113. },
  114. new KanBanSampleOuterItem()
  115. {
  116. DisplayName = "TERMINADO",
  117. Items =
  118. {
  119. new KanBanSampleInnerItem("A"),
  120. new KanBanSampleInnerItem("B"),
  121. }
  122. }
  123.  
  124. };
  125. }
  126. }
  127.  
  128. public class KanBanSampleOuterItem
  129. {
  130. public string DisplayName { get; set; }
  131.  
  132. public List<KanBanSampleInnerItem> Items { get; set; }
  133.  
  134. public KanBanSampleOuterItem()
  135. {
  136. Items = new List<KanBanSampleInnerItem>();
  137. }
  138. }
  139.  
  140. public class KanBanSampleInnerItem
  141. {
  142. public KanBanSampleInnerItem(string displayName)
  143. {
  144. DisplayName = displayName;
  145. }
  146.  
  147. public string DisplayName { get; set; }
  148. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement