Panely ve Windows Universal Apps Platform

Hlavni Panely ve Windows 10 Universal Apps, mohou byt pouzity kdekoliv v kodu Pro vice informaci navstivte MSDN odkud jsem cerpal i ja informace. Zde jsou pouze ty nejzakladnejsi, na MSDN to mate rozepsano blize.

Windows.UI.Xaml.Controls.RelativePanel

Dedi z Panel, neni z ni odvozeno nic Defines an area within which you can position and align child objects in relation to each other or the parent panel. Panel ktery umi jakkoliv pozicovat element ve vztahu k jinym elementum. Vice napovi kod:

<RelativePanel BorderBrush="Gray" BorderThickness="1">
   <Rectangle x:Name="RedRect" Fill="Red" Height="44" Width="44"></Rectangle>
   <Rectangle x:Name="BlueRect" Fill="Blue" Height="44" Width="88" RelativePanel.RightOf="RedRect"></Rectangle>
   <Rectangle x:Name="GreenRect" Fill="Green" Height="44" RelativePanel.Below="RedRect" RelativePanel.AlignLeftWith="RedRect" RelativePanel.AlignRightWith="BlueRect"></Rectangle>
   <Rectangle Fill="Yellow" RelativePanel.Below="GreenRect" RelativePanel.AlignLeftWith="BlueRect" RelativePanel.AlignRightWithPanel="True" RelativePanel.AlignBottomWithPanel="True"></Rectangle>
</RelativePanel> 


RelativePanel

Windows.UI.Xaml.Controls.StackPanel

Dedi z Panel, neni z ni odvozeno nic Arranges child elements into a single line that can be oriented horizontally or vertically. Panel znamy od prvni verze WPF – jednoduse posklada prvky do radku nebo sloupce.

<StackPanel>
   <Rectangle Fill="Red" Height="44"></Rectangle>
   <Rectangle Fill="Blue" Height="44"></Rectangle>
   <Rectangle Fill="Green" Height="44"></Rectangle>
   <Rectangle Fill="Yellow" Height="44"></Rectangle>
</StackPanel> 


StackPanel

Windows.UI.Xaml.Controls.Grid

Dedi z Panel, jsou z ni odvozeny SwapChainBackgroundPanel, SwapChainPanel Defines a flexible grid area that consists of columns and rows. Child elements of the Grid are measured and arranged according to their row/column assignments (set by using Grid.Row and Grid.Column attached properties) and other logic. Controls usporadane do tabulek, kde kazdy radek a sloupcec ma:

  1. Procentualni velikost/veskery dostupny volny prostor
  2. Presnou velikost
  3. Velikost akorat pro pohodlne zobrazeni(Auto)
<Grid>
   <Grid.RowDefinitions>
       <RowDefinition></RowDefinition>
       <RowDefinition Height="44"></RowDefinition>
   </Grid.RowDefinitions>
   <Grid.ColumnDefinitions>
       <ColumnDefinition Width="Auto"></ColumnDefinition>
       <ColumnDefinition></ColumnDefinition>
   </Grid.ColumnDefinitions>
   <Rectangle Fill="Red" Width="44"></Rectangle>
   <Rectangle Fill="Blue" Grid.Row="1"></Rectangle>
   <Rectangle Fill="Green" Grid.Column="1"></Rectangle>
   <Rectangle Fill="Yellow" Grid.Row="1" Grid.Column="1"></Rectangle>
</Grid> 


Grid

Windows.UI.Xaml.Controls.VariableSizedWrapGrid

Dedi z Panel, neni z ni odvozeno nic Provides a grid-style layout panel where each tile/cell can be variable size based on content. Jeji klicova vlastnost je MaximumRowsOrColumns. Dejme tomu ze mame ji nastavenou na 2 a vlozime 5 prvku. V prvnim radku budou 2, v druhem 2 a ve tretim 1. Pokud nektery prvek vezme vice prostoru do sirky/vysky, budou mit stejny dostupny prostor i ostatni prvky ve sloupci/radku. Je tedy podobna Grid, s tim rozdilem, ze sirka a vyska je vzdy “Auto”. Prednost ma ale usporadani do mrizky, to znamena ze primarne se snazi zaplnit vsechny bunky tabulek. Proto nemusi vzdy byt pocet radku/sloupcu takovy jaky jste specifikovali.

<VariableSizedWrapGrid MaximumRowsOrColumns="3" ItemHeight="44" ItemWidth="44">
   <Rectangle Fill="Red"></Rectangle>
   <Rectangle Fill="Blue" VariableSizedWrapGrid.RowSpan="2"></Rectangle>
   <Rectangle Fill="Green" VariableSizedWrapGrid.ColumnSpan="2"></Rectangle>
   <Rectangle Fill="Yellow" VariableSizedWrapGrid.RowSpan="2" VariableSizedWrapGrid.ColumnSpan="2"></Rectangle>
</VariableSizedWrapGrid> 


VariableSizedWrapGrid

Windows.UI.Xaml.Controls.Canvas

Dedi z Panel, je z ni odvozeno LoopingSelectorPanel, PivotHeaderPanel Defines an area within which you can explicitly position child objects, using coordinates that are relative to the Canvas area. Dalsi Panel control ktery nestarne. Zobrazuje prvky na souradnicich relativne k jeho bodu 0,0. Mohou se ruzne prekryvat a mit nastaveny ruzny z-index.

<Canvas Width="120" Height="120">
   <Rectangle Fill="Red" Height="44" Width="44"></Rectangle>
   <Rectangle Fill="Blue" Height="44" Width="44" Canvas.Left="20" Canvas.Top="20"></Rectangle>
   <Rectangle Fill="Green" Height="44" Width="44" Canvas.Left="40" Canvas.Top="40"></Rectangle>
   <Rectangle Fill="Yellow" Height="44" Width="44" Canvas.Left="60" Canvas.Top="60"></Rectangle>
</Canvas> 


Canvas

Muzou byt pouzity pouze v sablone ItemsControl:

Windows.UI.Xaml.Controls.ItemsStackPanel

Dedi z Panel, trida je sealed Arranges child elements into a single line that can be oriented horizontally or vertically. Supports pixel-based UI virtualization and grouped layouts. Can only be used to display items in an ItemsControl that shows multiple items; not supported for ComboBox and FlipView. Podobny jako VirtualizingStackPanel, hodi se pro mensi mnozstvi polozek. Trida zacina “Items”, to znamena ze obsah neni virtualizovany, jako u trid zacinajici na “Virtualized”.

Windows.UI.Xaml.Controls.ItemsWrapGrid

Dedi z Panel, trida je sealed Positions child elements sequentially from left to right or top to bottom. When elements extend beyond the container edge, elements are positioned in the next row or column. Supports pixel-based UI virtualization and grouped layouts. Can only be used to display items in an ItemsControl that shows multiple items; not supported for ComboBox and FlipView.

Windows.UI.Xaml.Controls.VirtualizingStackPanel

Dedi z OrientedVirtualizingPanel, trida je sealed Arranges and virtualizes content on a single line that is oriented either horizontally or vertically. Can only be used to display items in an ItemsControl. Hodi se kdyz mate control s vlastnosti ItemsPanel ktery zaroven zobrazuje velke mnozstvi polozek – tyto polozky pak pri zmizeni z obrazovky se nelikviduji ale pouze se zmeni jejich obsah, coz je vyrazne rychlejsi a uspornejsi.

Windows.UI.Xaml.Controls.WrapGrid

Dedi z OrientedVirtualizingPanel, trida je sealed Positions child elements sequentially from left to right or top to bottom. When elements extend beyond the container edge, elements are positioned in the next row or column. Can only be used to display items in an ItemsControl. Pouzivat pro prvky ComboBox a FlipView, protoze trida ItemsWrapGrid je nepodporuje.

Pro pouziti v kodu XAML pro vytvoreni zcela noveho prvku z Panel

Windows.UI.Xaml.Controls.Primitives.CalendarPanel

Dedi z Panel, trida je sealed Represents a panel that contains a calendar. Jak jiz dokumentace vyvojaru MS napovida, jedna se o panel, ktery jen rika, ze obsahuje kalendar. Veskery kod je ale uz na vas – cely kalendar si musite vybudovat na zelene louce.

DirectX panely

Windows.UI.Xaml.Controls.SwapChainBackgroundPanel

Dedi z Grid, neni z ni odvozeno nic Implements a XAML layout surface target for Microsoft DirectX interoperation scenarios.

Windows.UI.Xaml.Controls.SwapChainPanel

Dedi z Grid, neni z ni odvozeno nic Provides a hosting surface, where Microsoft DirectX swap chains provide content that can be rendered into a XAML UI. A SwapChainPanel element is a key component for an app that renders Microsoft DirectX graphics and then presents those visuals within a XAML page.

Bazove tridy pro jine Panely

Windows.UI.Xaml.Controls.VirtualizingPanel

Dedi z VirtualizingPanel, jsou z ni odvozeny CarouselPanel, OrientedVirtualizingPanel Provides a framework for Panel elements that virtualize their visual children.

Windows.UI.Xaml.Controls.Primitives.OrientedVirtualizingPanel

Dedi z VirtualizingPanel, jsou z ni odvozeny VirtualizingStackPanel, WrapGrid Adds infrastructure (provides base class) for virtualizing layout containers that support spatial cues, such as VirtualizingStackPanel and WrapGrid.

Pro pouziti pouze se specifickymi prvky

Windows.UI.Xaml.Controls.Primitives.CarouselPanel

Dedi z Panel, neni z ni odvozeno nic Represents a panel that arranges its items in a line and circles around to the first item when the last item is reached. MSDN dale pise:

CarouselPanel can’t be used as a stand-alone control, it can only be used as the

ItemsPanel of an

ItemsControl . It’s the default

ItemsPanel for the

ComboBox control, and is not supported for use with any other

ItemsControl . Coz znamena ze CarouselPanel lze pouzit jen jako panel template pouze v ComboBoxu. U vseho ostatniho vyhodi app vyjimku “The Panel you are using for the Control is not allowed as an ItemsPanel for the Control.”

Windows.UI.Xaml.Controls.Primitives.LoopingSelectorPanel

Dedi z Panel, trida je sealed A panel for positioning and arranging child LoopingSelector elements. LoopingSelector je trida ktera dava schopnost aplikace zobrazit seznam polozek ktery nikdy nekonci – pri dosazeni posledni polozky se plynule prejde na prvni polozku.

Windows.UI.Xaml.Controls.Primitives.PivotHeaderPanel

Dedi z Canvas, trida je sealed Displays the header text of the items in a Pivot control. Zajistuje zobrazeni textu zalozky v control Pivot.

Windows.UI.Xaml.Controls.Primitives.PivotPanel

Dedi z Panel, trida je sealed Displays the items in a Pivot control. Zobrazuje obsah zalozky v control Pivot.

Leave a Reply