|
<!--
// (c) Copyright Microsoft Corporation.
// This source is subject to the Microsoft Public License (Ms-PL).
// Please see http://go.microsoft.com/fwlink/?LinkID=131993 for details.
// All other rights reserved.
-->
<UserControl
xmlns="http://schemas.microsoft.com/client/2007"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="clr-namespace:Microsoft.Windows.Controls;assembly=Microsoft.Windows.Controls"
x:Class="Microsoft.Windows.Controls.Samples.HeaderedItemsControlSample">
<StackPanel>
<!-- Basic Usage -->
<ContentControl Content="Basic Usage" Style="{StaticResource Header}" />
<controls:HeaderedItemsControl x:Name="MicrosoftExecutives" Margin="10">
<controls:HeaderedItemsControl.Header>
<TextBlock Text="Microsoft Executives" FontWeight="Bold" FontSize="16" />
</controls:HeaderedItemsControl.Header>
<controls:HeaderedItemsControl.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<TextBlock Text="{Binding FirstName}" Margin="10 0 4 0" />
<TextBlock Text="{Binding LastName}" />
</StackPanel>
</DataTemplate>
</controls:HeaderedItemsControl.ItemTemplate>
</controls:HeaderedItemsControl>
<src:SourceViewer xmlns:src="clr-namespace:Microsoft.Windows.Controls.Samples;assembly=Microsoft.Windows.Controls.Samples.Common" xmlns:sys="clr-namespace:System;assembly=mscorlib">
<src:SourceFile Path="HeaderedItemsControlSample.xaml">
<src:SourceFile.Source>
<sys:String><!--
// (c) Copyright Microsoft Corporation.
// This source is subject to the Microsoft Public License (Ms-PL).
// Please see http://go.microsoft.com/fwlink/?LinkID=131993 for details.
// All other rights reserved.
-->
<UserControl
xmlns="http://schemas.microsoft.com/client/2007"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="clr-namespace:Microsoft.Windows.Controls;assembly=Microsoft.Windows.Controls"
x:Class="Microsoft.Windows.Controls.Samples.HeaderedItemsControlSample">
<StackPanel>
<!-- Basic Usage -->
<ContentControl Content="Basic Usage" Style="{StaticResource Header}" />
<controls:HeaderedItemsControl x:Name="MicrosoftExecutives" Margin="10">
<controls:HeaderedItemsControl.Header>
<TextBlock Text="Microsoft Executives" FontWeight="Bold" FontSize="16" />
</controls:HeaderedItemsControl.Header>
<controls:HeaderedItemsControl.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<TextBlock Text="{Binding FirstName}" Margin="10 0 4 0" />
<TextBlock Text="{Binding LastName}" />
</StackPanel>
</DataTemplate>
</controls:HeaderedItemsControl.ItemTemplate>
</controls:HeaderedItemsControl>
</StackPanel>
</UserControl></sys:String>
</src:SourceFile.Source>
</src:SourceFile>
<src:SourceFile Path="HeaderedItemsControlSample.xaml.cs">
<src:SourceFile.Source>
<sys:String>// (c) Copyright Microsoft Corporation.
// This source is subject to the Microsoft Public License (Ms-PL).
// Please see http://go.microsoft.com/fwlink/?LinkID=131993 for details.
// All other rights reserved.
using System;
using System.Diagnostics.CodeAnalysis;
using System.Windows;
using System.Windows.Controls;
using System.ComponentModel;
namespace Microsoft.Windows.Controls.Samples
{
/// <summary>
/// Sample page demonstrating the HeaderedItemsControl.
/// </summary>
[SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Headered", Justification = "Name of the control")]
[Sample("(4)HeadredItemsControl", DifficultyLevel.Basic)]
[Category("TreeView")]
public partial class HeaderedItemsControlSample : UserControl
{
/// <summary>
/// Initializes a new instance of the HeaderedItemsControlSample class.
/// </summary>
public HeaderedItemsControlSample()
{
InitializeComponent();
Loaded += OnLoaded;
}
/// <summary>
/// Load the demonstration.
/// </summary>
/// <param name="sender">Sample page.</param>
/// <param name="e">Event arguments.</param>
private void OnLoaded(object sender, RoutedEventArgs e)
{
MicrosoftExecutives.ItemsSource = Employee.Executives;
}
}
}</sys:String>
</src:SourceFile.Source>
</src:SourceFile>
</src:SourceViewer>
</StackPanel>
</UserControl>
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.