added samples
[windows-sources.git] / sdk / samples / WPFSamples / SamplesGallery / csharp / samps / grid_samp.xaml
bloba75e65c9ce13b5f6161159760f6da4d5a34c0777
1 <Page xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
2       xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
3       Title="Grid Sample"
4       x:Class="Grid_Samp.Page1"
5       Loaded="checkLang">
7     <TabControl MinHeight="500" MaxHeight="700" MinWidth="400">
8         <TabItem Style="{StaticResource TabStyle}" Header="Grid Element" IsSelected="true">
9             <StackPanel>
10             <TextBlock Style="{StaticResource HeaderStyle}">Grid Element Sample</TextBlock>
11     
12             <TextBlock Style="{StaticResource mainContentStyle}">Grid defines a flexible grid area consisting of columns and rows. Child elements of a Grid can be positioned precisely using the Margin property.</TextBlock>
14             </StackPanel>
15         </TabItem>
16         
17         <TabItem Name="xaml" Style="{StaticResource TabStyle}" Header="XAML">
18             <ScrollViewer HorizontalScrollBarVisibility="Visible">
19             <TextBlock Name="xamlCheck">
20             <TextBox Style="{StaticResource CodeSnippetParagraph}" xml:space="preserve">
21     &lt;Border BorderBrush="Black">
23         &lt;Grid ShowGridLines="false" Background="White">
24             &lt;Grid.Resources>
25                 &lt;Style TargetType="{x:Type ColumnDefinition}">
26                     &lt;Setter Property="ColumnDefinition.Width" Value="30"/>
27                 &lt;/Style>
28                 &lt;Style TargetType="{x:Type Rectangle}">
29                     &lt;Setter Property="Rectangle.RadiusX" Value="6"/>
30                     &lt;Setter Property="Rectangle.RadiusY" Value="6"/>
31                 &lt;/Style>
32                 &lt;Style x:Key="DayOfWeek">
33                     &lt;Setter Property="Grid.Row" Value="1">&lt;/Setter>
34                     &lt;Setter Property="TextBlock.Margin" Value="5">&lt;/Setter>
35                 &lt;/Style>
36                 &lt;Style x:Key="OneDate">
37                     &lt;Setter Property="TextBlock.Margin" Value="5">&lt;/Setter>
38                 &lt;/Style>                
39             &lt;/Grid.Resources>
40             &lt;Grid.ColumnDefinitions>
41             &lt;ColumnDefinition/>
42             &lt;ColumnDefinition/>
43             &lt;ColumnDefinition/>
44             &lt;ColumnDefinition/>
45             &lt;ColumnDefinition/>
46             &lt;ColumnDefinition/>
47             &lt;ColumnDefinition/>
48             &lt;ColumnDefinition Width="*"/>
49             &lt;!-- This column will receive all remaining width -->
50             &lt;/Grid.ColumnDefinitions>
51             &lt;Grid.RowDefinitions>
52             &lt;RowDefinition Height="Auto"/>
53             &lt;RowDefinition Height="Auto"/>
54             &lt;RowDefinition Height="Auto"/>
55             &lt;RowDefinition Height="Auto"/>
56             &lt;RowDefinition Height="Auto"/>
57             &lt;RowDefinition Height="Auto"/>
58             &lt;RowDefinition Height="Auto"/>
59             &lt;RowDefinition/>
60             &lt;!-- This row will receive all remaining Height -->
61             &lt;/Grid.RowDefinitions>
63             &lt;!-- These Rectangles constitute the backgrounds of the various Rows and Columns -->
66             &lt;Rectangle Grid.ColumnSpan="7" Fill="#73B2F5"/>
67             &lt;Rectangle Grid.Row="1" Grid.RowSpan="6"  Fill="#73B2F5"/>
68             &lt;Rectangle Grid.Column="6" Grid.Row="1" Grid.RowSpan="6" Fill="#73B2F5"/>
69             &lt;Rectangle Grid.Column="1" Grid.Row="1" Grid.ColumnSpan="5" Grid.RowSpan="6"
70               Fill="#efefef"/>
72             &lt;!-- Month row -->
73             &lt;TextBlock Grid.ColumnSpan="7" Margin="0,5,0,5" HorizontalAlignment="Center">
74                 January 2004&lt;/TextBlock>
76             &lt;!-- Draws a separator under the days-of-the-week row -->
78             &lt;Rectangle Grid.Row="1" Grid.ColumnSpan="7" 
79             Fill="Black" RadiusX="1" RadiusY="1" Height="2" Margin="0,20,0,0"/>
81             &lt;!-- Day-of-the-week row -->
82             &lt;TextBlock Grid.Column="0" Style="{StaticResource DayOfWeek}">Sun&lt;/TextBlock>
83             &lt;TextBlock Grid.Column="1" Style="{StaticResource DayOfWeek}">Mon&lt;/TextBlock>
84             &lt;TextBlock Grid.Column="2" Style="{StaticResource DayOfWeek}">Tue&lt;/TextBlock>
85             &lt;TextBlock Grid.Column="3" Style="{StaticResource DayOfWeek}">Wed&lt;/TextBlock>
86             &lt;TextBlock Grid.Column="4" Style="{StaticResource DayOfWeek}">Thu&lt;/TextBlock>
87             &lt;TextBlock Grid.Column="5" Style="{StaticResource DayOfWeek}">Fri&lt;/TextBlock>
88             &lt;TextBlock Grid.Column="6" Style="{StaticResource DayOfWeek}">Sat&lt;/TextBlock>
90             &lt;!-- Dates go here -->
91             &lt;TextBlock Grid.Column="4" Grid.Row="2" Style="{StaticResource OneDate}">1&lt;/TextBlock>
92             &lt;TextBlock Grid.Column="5" Grid.Row="2" Style="{StaticResource OneDate}">2&lt;/TextBlock>
93             &lt;TextBlock Grid.Column="6" Grid.Row="2" Style="{StaticResource OneDate}">3&lt;/TextBlock>
94             &lt;TextBlock Grid.Column="0" Grid.Row="3" Style="{StaticResource OneDate}">4&lt;/TextBlock>
95             &lt;TextBlock Grid.Column="1" Grid.Row="3" Style="{StaticResource OneDate}">5&lt;/TextBlock>
96             &lt;TextBlock Grid.Column="2" Grid.Row="3" Style="{StaticResource OneDate}">6&lt;/TextBlock>
97             &lt;TextBlock Grid.Column="3" Grid.Row="3" Style="{StaticResource OneDate}">7&lt;/TextBlock>
98             &lt;TextBlock Grid.Column="4" Grid.Row="3" Style="{StaticResource OneDate}">8&lt;/TextBlock>
99             &lt;TextBlock Grid.Column="5" Grid.Row="3" Style="{StaticResource OneDate}">9&lt;/TextBlock>
100             &lt;TextBlock Grid.Column="6" Grid.Row="3" Style="{StaticResource OneDate}">10&lt;/TextBlock>
101             &lt;TextBlock Grid.Column="0" Grid.Row="4" Style="{StaticResource OneDate}">11&lt;/TextBlock>
102             &lt;TextBlock Grid.Column="1" Grid.Row="4" Style="{StaticResource OneDate}">12&lt;/TextBlock>
103             &lt;TextBlock Grid.Column="2" Grid.Row="4" Style="{StaticResource OneDate}">13&lt;/TextBlock>
104             &lt;TextBlock Grid.Column="3" Grid.Row="4" Style="{StaticResource OneDate}">14&lt;/TextBlock>
105             &lt;TextBlock Grid.Column="4" Grid.Row="4" Style="{StaticResource OneDate}">15&lt;/TextBlock>
106             &lt;TextBlock Grid.Column="5" Grid.Row="4" Style="{StaticResource OneDate}">16&lt;/TextBlock>
107             &lt;TextBlock Grid.Column="6" Grid.Row="4" Style="{StaticResource OneDate}">17&lt;/TextBlock>
108             &lt;TextBlock Grid.Column="0" Grid.Row="5" Style="{StaticResource OneDate}">18&lt;/TextBlock>
109             &lt;TextBlock Grid.Column="1" Grid.Row="5" Style="{StaticResource OneDate}">19&lt;/TextBlock>
110             &lt;TextBlock Grid.Column="2" Grid.Row="5" Style="{StaticResource OneDate}">20&lt;/TextBlock>
111             &lt;TextBlock Grid.Column="3" Grid.Row="5" Style="{StaticResource OneDate}">21&lt;/TextBlock>
112             &lt;TextBlock Grid.Column="4" Grid.Row="5" Style="{StaticResource OneDate}">22&lt;/TextBlock>
113             &lt;TextBlock Grid.Column="5" Grid.Row="5" Style="{StaticResource OneDate}">23&lt;/TextBlock>
114             &lt;TextBlock Grid.Column="6" Grid.Row="5" Style="{StaticResource OneDate}">24&lt;/TextBlock>
115             &lt;TextBlock Grid.Column="0" Grid.Row="6" Style="{StaticResource OneDate}">25&lt;/TextBlock>
116             &lt;TextBlock Grid.Column="1" Grid.Row="6" Style="{StaticResource OneDate}">26&lt;/TextBlock>
117             &lt;TextBlock Grid.Column="2" Grid.Row="6" Style="{StaticResource OneDate}">27&lt;/TextBlock>
118             &lt;TextBlock Grid.Column="3" Grid.Row="6" Style="{StaticResource OneDate}">28&lt;/TextBlock>
119             &lt;TextBlock Grid.Column="4" Grid.Row="6" Style="{StaticResource OneDate}">29&lt;/TextBlock>
120             &lt;TextBlock Grid.Column="5" Grid.Row="6" Style="{StaticResource OneDate}">30&lt;/TextBlock>
121             &lt;TextBlock Grid.Column="6" Grid.Row="6" Style="{StaticResource OneDate}">31&lt;/TextBlock>
122         &lt;/Grid>
123     &lt;/Border>
124     </TextBox>
125             </TextBlock>    
126                 </ScrollViewer>
127         </TabItem>
128          <TabItem Name="xamlcsharp" Style="{StaticResource TabStyle}" Header="XAML + C#">
129             <TabControl TabStripPlacement="Right">
130                 <TabItem Name="xcsharpCheck" Style="{StaticResource TabStyle2}" Header="XAML"></TabItem>
131                 <TabItem Style="{StaticResource TabStyle2}" Header="C#"></TabItem>
132             </TabControl>  
133         </TabItem>
134         
135          <TabItem Name="xamlvb" Style="{StaticResource TabStyle}" Header="XAML + Visual Basic.NET">
136             <TabControl TabStripPlacement="Right">
137                 <TabItem Name="xvbCheck" Style="{StaticResource TabStyle2}" Header="XAML"></TabItem>
138                 <TabItem Style="{StaticResource TabStyle2}" Header="VB.NET"></TabItem>
139             </TabControl>
140          </TabItem> 
141         
142         <TabItem Name="csharp" Style="{StaticResource TabStyle}" Header="C#"></TabItem>        
143         
144         <TabItem Name="vb" Style="{StaticResource TabStyle}" Header="Visual Basic.NET"></TabItem>
145         
146         <TabItem Name="managedcpp" Style="{StaticResource TabStyle}" Header="Managed C++"></TabItem>
147         
148         <TabItem Style="{StaticResource TabStyle}" Header="Preview Sample">
149     <Border BorderBrush="Black">
151         <Grid ShowGridLines="false" Background="White">
152             <Grid.Resources>
153                 <Style TargetType="{x:Type ColumnDefinition}">
154                     <Setter Property="ColumnDefinition.Width" Value="30"/>
155                 </Style>
156                 <Style TargetType="{x:Type Rectangle}">
157                     <Setter Property="Rectangle.RadiusX" Value="6"/>
158                     <Setter Property="Rectangle.RadiusY" Value="6"/>
159                 </Style>
160                 <Style x:Key="DayOfWeek">
161                     <Setter Property="Grid.Row" Value="1"></Setter>
162                     <Setter Property="TextBlock.Margin" Value="5"></Setter>
163                 </Style>
164                 <Style x:Key="OneDate">
165                     <Setter Property="TextBlock.Margin" Value="5"></Setter>
166                 </Style>                
167             </Grid.Resources>
168           <Grid.ColumnDefinitions>
169             <ColumnDefinition/>
170             <ColumnDefinition/>
171             <ColumnDefinition/>
172             <ColumnDefinition/>
173             <ColumnDefinition/>
174             <ColumnDefinition/>
175             <ColumnDefinition/>
176             <ColumnDefinition Width="*"/>
177             <!-- This column will receive all remaining width -->
178           </Grid.ColumnDefinitions>
179           <Grid.RowDefinitions>
180             <RowDefinition Height="Auto"/>
181             <RowDefinition Height="Auto"/>
182             <RowDefinition Height="Auto"/>
183             <RowDefinition Height="Auto"/>
184             <RowDefinition Height="Auto"/>
185             <RowDefinition Height="Auto"/>
186             <RowDefinition Height="Auto"/>
187             <RowDefinition/>
188             <!-- This row will receive all remaining Height -->
189           </Grid.RowDefinitions>
190             <!-- These Rectangles constitute the backgrounds of the various Rows and Columns -->
193           <Rectangle Grid.ColumnSpan="7" Fill="#73B2F5"/>
194           <Rectangle Grid.Row="1" Grid.RowSpan="6"  Fill="#73B2F5"/>
195           <Rectangle Grid.Column="6" Grid.Row="1" Grid.RowSpan="6" Fill="#73B2F5"/>
196           <Rectangle Grid.Column="1" Grid.Row="1" Grid.ColumnSpan="5" Grid.RowSpan="6"
197           Fill="#efefef"/>
199             <!-- Month row -->
200             <TextBlock Grid.ColumnSpan="7" Margin="0,5,0,5" HorizontalAlignment="Center">
201                 January 2004</TextBlock>
203             <!-- Draws a separator under the days-of-the-week row -->
205             <Rectangle Grid.Row="1" Grid.ColumnSpan="7" 
206             Fill="Black" RadiusX="1" RadiusY="1" Height="2" Margin="0,20,0,0"/>
208             <!-- Day-of-the-week row -->
209             <TextBlock Grid.Column="0" Style="{StaticResource DayOfWeek}">Sun</TextBlock>
210             <TextBlock Grid.Column="1" Style="{StaticResource DayOfWeek}">Mon</TextBlock>
211             <TextBlock Grid.Column="2" Style="{StaticResource DayOfWeek}">Tue</TextBlock>
212             <TextBlock Grid.Column="3" Style="{StaticResource DayOfWeek}">Wed</TextBlock>
213             <TextBlock Grid.Column="4" Style="{StaticResource DayOfWeek}">Thu</TextBlock>
214             <TextBlock Grid.Column="5" Style="{StaticResource DayOfWeek}">Fri</TextBlock>
215             <TextBlock Grid.Column="6" Style="{StaticResource DayOfWeek}">Sat</TextBlock>
217             <!-- Dates go here -->
218             <TextBlock Grid.Column="4" Grid.Row="2" Style="{StaticResource OneDate}">1</TextBlock>
219             <TextBlock Grid.Column="5" Grid.Row="2" Style="{StaticResource OneDate}">2</TextBlock>
220             <TextBlock Grid.Column="6" Grid.Row="2" Style="{StaticResource OneDate}">3</TextBlock>
221             <TextBlock Grid.Column="0" Grid.Row="3" Style="{StaticResource OneDate}">4</TextBlock>
222             <TextBlock Grid.Column="1" Grid.Row="3" Style="{StaticResource OneDate}">5</TextBlock>
223             <TextBlock Grid.Column="2" Grid.Row="3" Style="{StaticResource OneDate}">6</TextBlock>
224             <TextBlock Grid.Column="3" Grid.Row="3" Style="{StaticResource OneDate}">7</TextBlock>
225             <TextBlock Grid.Column="4" Grid.Row="3" Style="{StaticResource OneDate}">8</TextBlock>
226             <TextBlock Grid.Column="5" Grid.Row="3" Style="{StaticResource OneDate}">9</TextBlock>
227             <TextBlock Grid.Column="6" Grid.Row="3" Style="{StaticResource OneDate}">10</TextBlock>
228             <TextBlock Grid.Column="0" Grid.Row="4" Style="{StaticResource OneDate}">11</TextBlock>
229             <TextBlock Grid.Column="1" Grid.Row="4" Style="{StaticResource OneDate}">12</TextBlock>
230             <TextBlock Grid.Column="2" Grid.Row="4" Style="{StaticResource OneDate}">13</TextBlock>
231             <TextBlock Grid.Column="3" Grid.Row="4" Style="{StaticResource OneDate}">14</TextBlock>
232             <TextBlock Grid.Column="4" Grid.Row="4" Style="{StaticResource OneDate}">15</TextBlock>
233             <TextBlock Grid.Column="5" Grid.Row="4" Style="{StaticResource OneDate}">16</TextBlock>
234             <TextBlock Grid.Column="6" Grid.Row="4" Style="{StaticResource OneDate}">17</TextBlock>
235             <TextBlock Grid.Column="0" Grid.Row="5" Style="{StaticResource OneDate}">18</TextBlock>
236             <TextBlock Grid.Column="1" Grid.Row="5" Style="{StaticResource OneDate}">19</TextBlock>
237             <TextBlock Grid.Column="2" Grid.Row="5" Style="{StaticResource OneDate}">20</TextBlock>
238             <TextBlock Grid.Column="3" Grid.Row="5" Style="{StaticResource OneDate}">21</TextBlock>
239             <TextBlock Grid.Column="4" Grid.Row="5" Style="{StaticResource OneDate}">22</TextBlock>
240             <TextBlock Grid.Column="5" Grid.Row="5" Style="{StaticResource OneDate}">23</TextBlock>
241             <TextBlock Grid.Column="6" Grid.Row="5" Style="{StaticResource OneDate}">24</TextBlock>
242             <TextBlock Grid.Column="0" Grid.Row="6" Style="{StaticResource OneDate}">25</TextBlock>
243             <TextBlock Grid.Column="1" Grid.Row="6" Style="{StaticResource OneDate}">26</TextBlock>
244             <TextBlock Grid.Column="2" Grid.Row="6" Style="{StaticResource OneDate}">27</TextBlock>
245             <TextBlock Grid.Column="3" Grid.Row="6" Style="{StaticResource OneDate}">28</TextBlock>
246             <TextBlock Grid.Column="4" Grid.Row="6" Style="{StaticResource OneDate}">29</TextBlock>
247             <TextBlock Grid.Column="5" Grid.Row="6" Style="{StaticResource OneDate}">30</TextBlock>
248             <TextBlock Grid.Column="6" Grid.Row="6" Style="{StaticResource OneDate}">31</TextBlock>
249         </Grid>
250     </Border>
251         </TabItem>
252     </TabControl>
253 </Page>