You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
341 lines
18 KiB
341 lines
18 KiB
<!--*********************************************************************
|
|
|
|
Extended WPF Toolkit
|
|
|
|
Copyright (C) 2010-2012 Xceed Software Inc.
|
|
|
|
This program is provided to you under the terms of the Microsoft Public
|
|
License (Ms-PL) as published at http://wpftoolkit.codeplex.com/license
|
|
|
|
This program can be provided to you by Xceed Software Inc. under a
|
|
proprietary commercial license agreement for use in non-Open Source
|
|
projects. The commercial version of Extended WPF Toolkit also includes
|
|
priority technical support, commercial updates, and many additional
|
|
useful WPF controls if you license Xceed Business Suite for WPF.
|
|
|
|
Visit http://xceed.com and follow @datagrid on Twitter.
|
|
|
|
********************************************************************-->
|
|
<sample:DemoView x:Class="Samples.Modules.Panels.Views.SwitchPanelView"
|
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
|
xmlns:sample="clr-namespace:Samples.Infrastructure.Controls;assembly=Samples.Infrastructure"
|
|
xmlns:local="clr-namespace:Samples.Modules.Panels.Views"
|
|
xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
|
|
xmlns:panels="clr-namespace:Xceed.Wpf.Toolkit.Panels;assembly=Xceed.Wpf.Toolkit"
|
|
xmlns:conv="clr-namespace:Samples.Modules.Panels.Converters"
|
|
xmlns:s="clr-namespace:System;assembly=mscorlib"
|
|
VerticalScrollBarVisibility="Disabled"
|
|
Title="Switch Panel"
|
|
Description="The SwitchPanel allows you to animate the children between different layouts.">
|
|
<sample:DemoView.Resources>
|
|
<Style x:Key="panelElement" TargetType="{x:Type TextBlock}">
|
|
<Setter Property="Background" Value="Blue" />
|
|
<Setter Property="Foreground" Value="White" />
|
|
<Setter Property="Margin" Value="5" />
|
|
<Setter Property="Width" Value="100" />
|
|
<Setter Property="Height" Value="100" />
|
|
<Setter Property="TextAlignment" Value="Center" />
|
|
</Style>
|
|
|
|
<ObjectDataProvider x:Key="orientationCombo" MethodName="GetValues" ObjectType="{x:Type s:Enum}">
|
|
<ObjectDataProvider.MethodParameters>
|
|
<x:Type TypeName="Orientation" />
|
|
</ObjectDataProvider.MethodParameters>
|
|
</ObjectDataProvider>
|
|
|
|
<Style x:Key="controlInError" TargetType="Control">
|
|
<Style.Triggers>
|
|
<Trigger Property="Validation.HasError" Value="true">
|
|
<Setter Property="ToolTip" Value="{Binding RelativeSource={x:Static RelativeSource.Self},
|
|
Path=(Validation.Errors).CurrentItem.ErrorContent}" />
|
|
</Trigger>
|
|
</Style.Triggers>
|
|
</Style>
|
|
|
|
<Style x:Key="plusItem" TargetType="ComboBoxItem" >
|
|
<Setter Property="HorizontalContentAlignment" Value="Stretch"/>
|
|
<Setter Property="ContentTemplate">
|
|
<Setter.Value>
|
|
<DataTemplate>
|
|
<DockPanel>
|
|
<TextBlock DockPanel.Dock="Left" Text="{Binding}" />
|
|
<TextBlock TextAlignment="Right" Foreground="OrangeRed" Style="{StaticResource plusSuffix}" />
|
|
</DockPanel>
|
|
</DataTemplate>
|
|
</Setter.Value>
|
|
</Setter>
|
|
</Style>
|
|
|
|
<s:String x:Key="wrapPanelDescription">Positions elements from left to right or up to down depending on the orientation and the available space. Breaks the content at the end of the line to wrap items to the next line.</s:String>
|
|
<s:String x:Key="randomPanelDescription">This panel lays out its children with a random location and size.</s:String>
|
|
<s:String x:Key="canvasPanelDescription">Exactly like WPF's native Canvas panel, except that this panel can animate its children and be used inside a SwitchPanel.</s:String>
|
|
<s:String x:Key="carouselDescription">Positions the elements in a carousel mode with a centered element in front.</s:String>
|
|
<s:String x:Key="dockPanelDescription">Exactly like WPF's native DockPanel, except that this panel can animate its children and be used inside a SwitchPanel.</s:String>
|
|
<s:String x:Key="gridDescription">Exactly like WPF's native Grid panel, except that this panel can animate its children and be used inside a SwitchPanel.</s:String>
|
|
<s:String x:Key="stackPanelDescription">Exactly like WPF's native StackPanel, except this panel can animate its children and be used inside SwitchPanel.</s:String>
|
|
<s:String x:Key="stackedStackPanelDescription">Lays out children in a series of stacked stackpanels.</s:String>
|
|
<s:String x:Key="autoStretchStackPanelDescription">This panel stretches the children in the orientation direction so that they completely fill the panel area.</s:String>
|
|
<s:String x:Key="relativeCanvasDescription">A Panel which is similar to Canvas but it lays out its children relative to the panel's height and width.</s:String>
|
|
<s:String x:Key="radialCanvasDescription">Lays out its children in a circle based on panel size and/or properties set.</s:String>
|
|
<s:String x:Key="cameraPanelDescription">"CameraPanel lays out its children in a 3D-like space. You can give the children a 3D location and set the camera position for the panel.</s:String>
|
|
<s:String x:Key="perspectivePanelDescription">Perspective panel positions its children in a perspective view with the possibility of rotating the background children.</s:String>
|
|
<s:String x:Key="animatedTimelinePanelDescription">Defines an area where items are positioned on a timeline.</s:String>
|
|
|
|
<conv:ComboBoxToVisibilityConverter x:Key="comboBoxToVisibilityConverter" />
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</sample:DemoView.Resources>
|
|
|
|
<Grid>
|
|
<Grid.RowDefinitions>
|
|
<RowDefinition Height="Auto" />
|
|
<RowDefinition Height="*" />
|
|
</Grid.RowDefinitions>
|
|
|
|
<GroupBox Header="Features" Grid.Row="0" Margin="5">
|
|
<Grid Margin="5">
|
|
<Grid.ColumnDefinitions>
|
|
<ColumnDefinition Width="Auto" />
|
|
<ColumnDefinition Width="*" />
|
|
</Grid.ColumnDefinitions>
|
|
<TextBlock Text="Layout:" Margin="0,0,5,0" />
|
|
<ComboBox x:Name="layoutCombo" SelectedIndex="0" Width="250" SelectionChanged="OnLayoutComboSelectionChanged">
|
|
<ComboBoxItem>WrapPanel</ComboBoxItem>
|
|
<ComboBoxItem>RandomPanel</ComboBoxItem>
|
|
<ComboBoxItem Style="{StaticResource plusItem}">Canvas</ComboBoxItem>
|
|
<ComboBoxItem Style="{StaticResource plusItem}">Carousel</ComboBoxItem>
|
|
<ComboBoxItem Style="{StaticResource plusItem}">DockPanel</ComboBoxItem>
|
|
<ComboBoxItem Style="{StaticResource plusItem}">Grid</ComboBoxItem>
|
|
<ComboBoxItem Style="{StaticResource plusItem}">StackPanel</ComboBoxItem>
|
|
<ComboBoxItem Style="{StaticResource plusItem}">StackedStackPanel</ComboBoxItem>
|
|
<ComboBoxItem Style="{StaticResource plusItem}">AutoStretchStackPanel</ComboBoxItem>
|
|
<ComboBoxItem Style="{StaticResource plusItem}">RelativeCanvas</ComboBoxItem>
|
|
<ComboBoxItem Style="{StaticResource plusItem}">RadialCanvas</ComboBoxItem>
|
|
<ComboBoxItem Style="{StaticResource plusItem}">CameraPanel</ComboBoxItem>
|
|
<ComboBoxItem Style="{StaticResource plusItem}">PerspectivePanel</ComboBoxItem>
|
|
<ComboBoxItem Style="{StaticResource plusItem}">AnimatedTimelinePanel</ComboBoxItem>
|
|
</ComboBox>
|
|
</Grid>
|
|
</GroupBox>
|
|
|
|
<Grid Grid.Row="1" Margin="10">
|
|
<Grid.RowDefinitions >
|
|
<RowDefinition Height="Auto" />
|
|
<RowDefinition Height="*" />
|
|
<RowDefinition Height="Auto" />
|
|
<RowDefinition Height="Auto" />
|
|
</Grid.RowDefinitions>
|
|
<TextBlock Grid.Row="0" Text="Usage:" Style="{StaticResource Header}" />
|
|
|
|
<xctk:SwitchPanel x:Name="_switchPanel" Grid.Row="1" ActiveLayoutIndex="{Binding ElementName=layoutCombo, Path=SelectedIndex}" ActiveLayoutChanged="OnSwitchPanelLayoutChanged">
|
|
<xctk:SwitchPanel.Layouts>
|
|
<xctk:WrapPanel x:Name="_wrapPanel" ItemWidth="100" ItemHeight="100"/>
|
|
<xctk:RandomPanel x:Name="_randomPanel" />
|
|
</xctk:SwitchPanel.Layouts>
|
|
<TextBlock x:Name="_item1" Text="Item #1" Style="{StaticResource panelElement}"/>
|
|
<TextBlock x:Name="_item2" Text="Item #2" Style="{StaticResource panelElement}"/>
|
|
<TextBlock x:Name="_item3" Text="Item #3" Style="{StaticResource panelElement}"/>
|
|
<TextBlock x:Name="_item4" Text="Item #4" Style="{StaticResource panelElement}"/>
|
|
<TextBlock x:Name="_item5" Text="Item #5" Style="{StaticResource panelElement}"/>
|
|
<TextBlock x:Name="_item6" Text="Item #6" Style="{StaticResource panelElement}"/>
|
|
<TextBlock x:Name="_item7" Text="Item #7" Style="{StaticResource panelElement}"/>
|
|
<TextBlock x:Name="_item8" Text="Item #8" Style="{StaticResource panelElement}"/>
|
|
</xctk:SwitchPanel>
|
|
|
|
<Image x:Name="_openSourceScreenShot" Grid.Row="1" Height="250" Visibility="Collapsed" />
|
|
<TextBlock x:Name="_openSourceScreenShotDesc" Grid.Row="2" TextWrapping="Wrap" Visibility="Collapsed" />
|
|
<TextBlock x:Name="_openSourceHyperlink" Grid.Row="3" Visibility="Collapsed">
|
|
<Hyperlink NavigateUri="http://www.xceed.com/Extended_WPF_Toolkit_Intro.html" RequestNavigate="Hyperlink_RequestNavigate">
|
|
Click here for more details about Extended WPF Toolkit Plus.
|
|
</Hyperlink>
|
|
</TextBlock>
|
|
|
|
<GroupBox Header="WrapPanel Toolbox"
|
|
Background="White"
|
|
Grid.Row="2"
|
|
Visibility="{Binding SelectedIndex, ElementName=layoutCombo, Converter={StaticResource comboBoxToVisibilityConverter}, ConverterParameter=0}"
|
|
Margin="10" >
|
|
<StackPanel>
|
|
<TextBlock TextWrapping="Wrap"
|
|
Text="{StaticResource wrapPanelDescription}"
|
|
Margin="10,0" />
|
|
<TextBlock TextWrapping="Wrap"
|
|
Text="Resize the Window to animate the WrapPanel."
|
|
Margin="10,0" />
|
|
|
|
<Grid Margin="5">
|
|
<Grid.ColumnDefinitions>
|
|
<ColumnDefinition Width="Auto" />
|
|
<ColumnDefinition Width="Auto" />
|
|
<ColumnDefinition Width="Auto" />
|
|
<ColumnDefinition Width="Auto" />
|
|
</Grid.ColumnDefinitions>
|
|
<Grid.RowDefinitions>
|
|
<RowDefinition Height="Auto" />
|
|
<RowDefinition Height="Auto" />
|
|
</Grid.RowDefinitions>
|
|
|
|
<TextBlock Text="Orientation:" VerticalAlignment="Center"/>
|
|
<ComboBox Grid.Column="1"
|
|
ItemsSource="{Binding Source={StaticResource orientationCombo}}"
|
|
SelectedItem="{Binding Orientation, ElementName=_wrapPanel}"
|
|
Width="100"
|
|
Height="22"
|
|
VerticalAlignment="Center"
|
|
Margin="5" />
|
|
<TextBlock Grid.Row="1" Text="Is Child Order Reversed:" VerticalAlignment="Center"/>
|
|
<CheckBox Grid.Row="1"
|
|
Grid.Column="1"
|
|
IsChecked="{Binding IsChildOrderReversed, ElementName=_wrapPanel}"
|
|
ClickMode="Press"
|
|
VerticalAlignment="Center"
|
|
Margin="5"/>
|
|
<TextBlock Grid.Column="2" Text="Item Width:" VerticalAlignment="Center" Margin="10,0,0,0"/>
|
|
<xctk:DoubleUpDown Grid.Column="3"
|
|
Value="{Binding ItemWidth, ElementName=_wrapPanel}"
|
|
AllowInputSpecialValues="NaN"
|
|
Width="100"
|
|
Height="20"
|
|
Minimum="0"
|
|
Style="{StaticResource controlInError}"
|
|
VerticalAlignment="Center"
|
|
Margin="5"/>
|
|
<TextBlock Grid.Column="2" Grid.Row="1" Text="Item Height:" VerticalAlignment="Center" Margin="10,0,0,0" />
|
|
<xctk:DoubleUpDown Grid.Column="3"
|
|
Grid.Row="1"
|
|
Value="{Binding ItemHeight, ElementName=_wrapPanel}"
|
|
AllowInputSpecialValues="NaN"
|
|
Width="100"
|
|
Height="20"
|
|
Minimum="0"
|
|
Style="{StaticResource controlInError}"
|
|
VerticalAlignment="Center"
|
|
Margin="5"/>
|
|
</Grid>
|
|
</StackPanel>
|
|
</GroupBox>
|
|
|
|
<GroupBox Header="RandomPanel Toolbox"
|
|
Background="White"
|
|
Grid.Row="2"
|
|
Visibility="{Binding SelectedIndex, ElementName=layoutCombo, Converter={StaticResource comboBoxToVisibilityConverter}, ConverterParameter=1}"
|
|
Margin="10" >
|
|
<StackPanel>
|
|
<TextBlock TextWrapping="Wrap"
|
|
Text="{StaticResource randomPanelDescription}"
|
|
Margin="10,0" />
|
|
<TextBlock TextWrapping="Wrap"
|
|
Text="Modify the Minimum and Maximum values to affect the children size."
|
|
Margin="10,0" />
|
|
|
|
<Grid Margin="5">
|
|
<Grid.ColumnDefinitions>
|
|
<ColumnDefinition Width="Auto" />
|
|
<ColumnDefinition Width="Auto" />
|
|
<ColumnDefinition Width="Auto" />
|
|
<ColumnDefinition Width="Auto" />
|
|
</Grid.ColumnDefinitions>
|
|
<Grid.RowDefinitions>
|
|
<RowDefinition Height="Auto" />
|
|
<RowDefinition Height="Auto" />
|
|
</Grid.RowDefinitions>
|
|
|
|
<TextBlock Text="Minimum Width:" VerticalAlignment="Center"/>
|
|
<xctk:DoubleUpDown Grid.Column="1"
|
|
Value="{Binding MinimumWidth, ElementName=_randomPanel, ValidatesOnExceptions=True}"
|
|
AllowInputSpecialValues="None"
|
|
Minimum="0"
|
|
Maximum="100"
|
|
Width="100"
|
|
Height="20"
|
|
Style="{StaticResource controlInError}"
|
|
VerticalAlignment="Center"
|
|
Margin="5" />
|
|
<TextBlock Grid.Row="1" Text="Maximum Width:" VerticalAlignment="Center"/>
|
|
<xctk:DoubleUpDown Grid.Column="1"
|
|
Grid.Row="1"
|
|
Value="{Binding MaximumWidth, ElementName=_randomPanel, ValidatesOnExceptions=True}"
|
|
AllowInputSpecialValues="None"
|
|
Minimum="0"
|
|
Maximum="100"
|
|
Width="100"
|
|
Height="20"
|
|
Style="{StaticResource controlInError}"
|
|
VerticalAlignment="Center"
|
|
Margin="5" />
|
|
<TextBlock Grid.Column="2" Text="Minimum Height:" VerticalAlignment="Center" Margin="10,0,0,0"/>
|
|
<xctk:DoubleUpDown Grid.Column="3"
|
|
Value="{Binding MinimumHeight, ElementName=_randomPanel, ValidatesOnExceptions=True}"
|
|
AllowInputSpecialValues="None"
|
|
Minimum="0"
|
|
Maximum="100"
|
|
Width="100"
|
|
Height="20"
|
|
Style="{StaticResource controlInError}"
|
|
VerticalAlignment="Center"
|
|
Margin="5"/>
|
|
<TextBlock Grid.Column="2" Grid.Row="1" Text="Maximum Height:" VerticalAlignment="Center" Margin="10,0,0,0" />
|
|
<xctk:DoubleUpDown Grid.Column="3"
|
|
Grid.Row="1"
|
|
Value="{Binding MaximumHeight, ElementName=_randomPanel, ValidatesOnExceptions=True}"
|
|
AllowInputSpecialValues="None"
|
|
Minimum="0"
|
|
Maximum="100"
|
|
Width="100"
|
|
Height="20"
|
|
Style="{StaticResource controlInError}"
|
|
VerticalAlignment="Center"
|
|
Margin="5"/>
|
|
</Grid>
|
|
</StackPanel>
|
|
</GroupBox>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</Grid>
|
|
</Grid>
|
|
</sample:DemoView>
|
|
|