|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Announcements
Chapters
Services
Feature Zones
|
Contents
IntroductionWhen it comes to presenting data, there is a lot of emphasis on grids that present data in a single wide column, showing lots of fields horizontally. However, some data tend to be presented in narrow columns, such as address lists and book indices. Instead of complex navigation, they have letter buttons, so you can quickly get to everybody whose name starts with "K". And, now that lots of people use monitors that are much wider then they are high, it makes sense to put the column into a vertical The solution I came up with has a nice (I think) page transition effect. It supports paging at the data level, to minimize network traffic. Although people have already come up with Requirements
Installation
How to add the GroupHeader element and the improved WrapPanel to the toolbox
TallColumns ProjectIf you download the source file and open the solution, you'll find it contains a number of projects. The TallColumns and TallColumns2 projects contain the actual XAML. TallColumns2 is the same as TallColumns, except that it uses a By way of test data, a list of companies and their addresses is used. Page.xamlThe Page.xaml file starts with the two Storyboards that create the page transition effect when you move from page to page with the "Next" button, "Previous" button, etc. One blurs the page, and the other makes it visible again. The code actually updates the page contents after the first storyboard has completed but before starting the second storyboard. After the storyboard definitions comes a horizontal Finally, there is the Page.xaml.csWhen you look at Page.xaml.cs, you'll find that all the code that makes the tall columns work is in a separate class TallColumnsManager projectThe Db ProjectThis project acts as the Data Access Layer. It has the Obviously, this project is just a dummy, with the data hard coded (old timers will recognize the Northwind list of customers). However, it would be easy to change the implementation so it retrieves data over the network, minimizing traffic by only retrieving a page load of records instead of all available records. This wouldn't affect the class' interface or the rest of the tall columns code. WrapPanel ProjectImprovementsThis
WrapPanel Members
Methodsstatic WrapPanel GetWrapPanel(string name)
Given the name of a Example: WrapPanel wp = WrapPanel.GetWrapPanel("MainWrapPanel");
Properties
GroupHeader ProjectThis is a very simple element that makes it easy to insert single letter group headers in the list of records shown with an Say, you are showing the company name and address of a list of companies, sorted by company name, in an <ItemsControl ...>
<ItemsControl.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Vertical" >
<TextBlock FontWeight="Bold" Text="{Binding CompanyName}" />
<TextBlock Text="{Binding Address}" />
</StackPanel>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
With the A
Alfreds Futterkiste
Ana Trujillo Emparedados y helados
Antonio Moreno Taquería
B
Berglunds snabbköp
Blauer See Delikatessen
...
The <ItemsControl .....>
<ItemsControl.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Vertical" >
<my:GroupHeader GroupName="Main" GroupingValue="{Binding CompanyName}">
<my:GroupHeader.Template>
<ControlTemplate TargetType="my:GroupHeader">
<TextBlock x:Name="GroupHeaderText"></TextBlock>
</ControlTemplate>
</my:GroupHeader.Template>
</my:GroupHeader>
<TextBlock FontWeight="Bold" Text="{Binding CompanyName}" />
<TextBlock Text="{Binding Address}" />
</StackPanel>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
The Make sure that the Instead of a <my:GroupHeader GroupName="Main" GroupingValue="{Binding CompanyName}">
<my:GroupHeader.Template>
<ControlTemplate TargetType="my:GroupHeader">
<Button x:Name="GroupHeaderText" Click="LetterButton_Click"></Button>
</ControlTemplate>
</my:GroupHeader.Template>
</my:GroupHeader>
Bind the If you have more then one When you reload an For example: // Reset group before assigning new collection to the ItemsControl
GroupHeader.ResetGroup("Main");
MainItemsControl.DataContext = newCollection;
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||