| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400 |
- <Window x:Class="XamlTestApplication.MainWindow"
- xmlns="https://github.com/avaloniaui"
- xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
- xmlns:local="clr-namespace:XamlTestApplication;assembly=XamlTestApplicationPcl"
- xmlns:vm="clr-namespace:XamlTestApplication.ViewModels;assembly=XamlTestApplicationPcl"
- Title="Avalonia Test Application" Width="800" Height="600">
- <Grid RowDefinitions="Auto,*,Auto" ColumnDefinitions="*,*">
- <Menu Grid.ColumnSpan="2">
- <MenuItem Header="_File">
- <MenuItem Header="_Open" Command="{Binding OpenFileCommand}" />
- <MenuItem Header="_Open Folder" Command="{Binding OpenFolderCommand}" />
- <MenuItem Header="_Hello">
- <MenuItem Header="_Goodbye"/>
- <Separator/>
- <MenuItem Header="_World" />
- </MenuItem>
- <Separator Background="Red"/>
- <MenuItem Header="_Test"/>
- <Separator/>
- <MenuItem Name="exitMenu" Header="_Exit"/>
- </MenuItem>
- </Menu>
- <TabControl Grid.Row="1" Grid.ColumnSpan="2" Padding="5">
- <TabControl.Transition>
- <PageSlide Duration="0.25" />
- </TabControl.Transition>
-
- <TabItem Header="Buttons">
- <ScrollViewer CanScrollHorizontally="False">
- <StackPanel Margin="10" Gap="4">
- <TextBlock Text="Button" FontWeight="Medium" FontSize="20" Foreground="#212121" />
- <TextBlock Text="A button control" FontSize="13" Foreground="#727272" Margin="0,0,0,10" />
- <Button Content="Button" Width="150" />
- <Button Content="Button" Width="150" IsEnabled="False" />
- <TextBlock Text="ToggleButton" Margin="0, 40, 0, 0" FontSize="20" Foreground="#212121" />
- <TextBlock Text="A toggle button control" FontSize="13" Foreground="#727272" Margin="0,0,0,10" />
- <ToggleButton Width="150" IsChecked="True" Content="On" />
- <ToggleButton Width="150" IsChecked="False" Content="Off" />
- </StackPanel>
- </ScrollViewer>
- </TabItem>
- <TabItem Header="Text">
- <StackPanel Margin="10" Gap="4">
- <TextBlock Text="TextBlock with ContextMenu" FontWeight="Medium" FontSize="20" Foreground="#212121">
- <TextBlock.ContextMenu>
- <ContextMenu>
- <MenuItem Header="Testing 1" />
- <MenuItem Header="Testing 2" />
- <MenuItem Header="Testing 3" />
- <MenuItem Header="Testing 4">
- <MenuItem Header="SubItem 1" />
- <MenuItem Header="SubItem 2" />
- <MenuItem Header="SubItem 3" />
- <MenuItem Header="SubItem 4" />
- </MenuItem>
- </ContextMenu>
- </TextBlock.ContextMenu>
- </TextBlock>
- <TextBlock Text="A control for displaying text."
- FontSize="13"
- Foreground="#727272"
- Margin="0, 0, 0, 10" />
- <TextBlock Text="Lorem ipsum dolor sit amet, consectetuer adipiscing elit." FontSize="11" />
- <TextBlock Text="Lorem ipsum dolor sit amet, consectetuer adipiscing elit." FontSize="11"
- FontWeight="Medium" />
- <TextBlock Text="Lorem ipsum dolor sit amet, consectetuer adipiscing elit." FontSize="11"
- FontWeight="Bold" />
- <TextBlock Text="Lorem ipsum dolor sit amet, consectetuer adipiscing elit." FontSize="11"
- FontStyle="Italic" />
- <TextBlock Margin="0,40,0,0" Text="HtmlLabel" FontWeight="Medium" FontSize="20"
- Foreground="#212121" />
- <TextBlock Text="A label capable of displaying HTML content" FontSize="13" Foreground="#727272"
- Margin="0, 0, 0, 10" />
- </StackPanel>
- </TabItem>
- <TabItem Header="Input">
- <ScrollViewer CanScrollHorizontally="False">
- <StackPanel Margin="10" Gap="4">
- <TextBlock Text="TextBlock" FontWeight="Medium" FontSize="20" Foreground="#212121" />
- <TextBlock Text="A text box control"
- FontSize="13"
- Foreground="#727272"
- Margin="0, 0, 0, 10" />
- <TextBox Text="Lorem ipsum dolor sit amet, consectetur adipiscing elit." Width="200" />
- <TextBox Width="200" Watermark="Watermark" />
- <TextBox Width="200" Watermark="Floating Watermark" UseFloatingWatermark="True" />
- <TextBox AcceptsReturn="True" TextWrapping="Wrap" Width="200" Height="150"
- Text="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus magna. Cras in mi at felis aliquet congue. Ut a est eget ligula molestie gravida. Curabitur massa. Donec eleifend, libero at sagittis mollis, tellus est malesuada tellus, at luctus turpis elit sit amet quam. Vivamus pretium ornare est." />
- <TextBox Width="200" Text="Left aligned text" TextAlignment="Left" />
- <TextBox Width="200" Text="Center aligned text" TextAlignment="Center" />
- <TextBox Width="200" Text="Right aligned text" TextAlignment="Right" />
- <TextBlock Margin="0, 40, 0, 0" Text="CheckBox" FontWeight="Medium" FontSize="20"
- Foreground="#212121" />
- <TextBlock Text="A check box control" FontSize="13" Foreground="#727272" Margin="0, 0, 0, 10" />
- <CheckBox IsChecked="True" Margin="0, 0, 0, 5" Content="Checked" />
- <CheckBox IsChecked="False" Content="Unchecked" />
- <TextBlock Margin="0, 40, 0, 0" Text="RadioButton" FontWeight="Medium" FontSize="20"
- Foreground="#212121" />
- <TextBlock Text="A radio button control" FontSize="13" Foreground="#727272"
- Margin="0, 0, 0, 10" />
- <RadioButton IsChecked="True" Content="Option 1" />
- <RadioButton IsChecked="False" Content="Option 2" />
- <RadioButton IsChecked="False" Content="Option 3" />
- </StackPanel>
- </ScrollViewer>
- </TabItem>
- <TabItem Header="Images">
- <StackPanel Margin="10" Gap="4" HorizontalAlignment="Center">
- <TextBlock Text="Carousel" FontWeight="Medium" FontSize="20" Foreground="#212121" />
- <TextBlock Text="An items control that displays its items as pages that fill the controls."
- FontSize="13"
- Foreground="#727272" Margin="0, 0, 0, 10" />
- <StackPanel Name="carouselVisual" Orientation="Horizontal">
- <Button VerticalAlignment="Center" Margin="5">
- <Button.Content>
- <Path Fill="Black"
- Data="M20,11V13H8L13.5,18.5L12.08,19.92L4.16,12L12.08,4.08L13.5,5.5L8,11H20Z" />
- </Button.Content>
- </Button>
- <Carousel Width="400" Height="400">
- <Carousel.Transition>
- <PageSlide Duration="0.25" />
- </Carousel.Transition>
- <Image Source="github_icon.png" Width="400" Height="400" />
- <Image Source="pattern.jpg" Width="400" Height="400" />
- </Carousel>
- <Button VerticalAlignment="Center" Margin="5">
- <Button.Content>
- <Path Fill="Black"
- Data="M4,11V13H16L10.5,18.5L11.92,19.92L19.84,12L11.92,4.08L10.5,5.5L16,11H4Z" />
- </Button.Content>
- </Button>
- </StackPanel>
- </StackPanel>
- </TabItem>
- <TabItem Header="Lists">
- <StackPanel Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Center">
- <ListBox Items="{Binding Items}" SelectionMode="Multiple">
- <ListBox.ItemTemplate>
- <DataTemplate DataType="vm:TestItem">
- <StackPanel>
- <TextBlock Text="{Binding Header}" FontSize="24" />
- <TextBlock Text="{Binding SubHeader}" />
- </StackPanel>
- </DataTemplate>
- </ListBox.ItemTemplate>
- </ListBox>
- <DropDown VerticalAlignment="Center" SelectedIndex="0">
- <StackPanel>
- <TextBlock Text="Item 1" FontSize="24" />
- <TextBlock Text="Item 1 Value" />
- </StackPanel>
- <StackPanel>
- <TextBlock Text="Item 2" FontSize="24" />
- <TextBlock Text="Item 2 Value" />
- </StackPanel>
- </DropDown>
- <TreeView Items="{Binding Nodes}">
- <TreeView.Styles>
- <Style Selector="TreeViewItem">
- <Setter Property="IsExpanded" Value="{Binding IsExpanded, Mode=TwoWay}"/>
- </Style>
- </TreeView.Styles>
- <TreeView.ItemTemplate>
- <TreeDataTemplate DataType="vm:TestNode" ItemsSource="{Binding Children}">
- <StackPanel>
- <TextBlock Text="{Binding Header}" FontSize="24" />
- <TextBlock Text="{Binding SubHeader}" />
- </StackPanel>
- </TreeDataTemplate>
- </TreeView.ItemTemplate>
- </TreeView>
- <StackPanel Orientation="Vertical" Gap="4">
- <Button Command="{Binding CollapseNodesCommand}">Collapse Nodes</Button>
- <Button Command="{Binding ExpandNodesCommand}">Expand Nodes</Button>
- </StackPanel>
- </StackPanel>
- </TabItem>
- <TabItem Header="Layout">
- <ScrollViewer CanScrollHorizontally="False">
- <StackPanel Margin="10" Gap="4">
- <TextBlock Text="Grid" FontWeight="Medium" FontSize="20" Foreground="#212121" />
- <TextBlock Text="Lays out child controls according to a grid."
- FontSize="13"
- Foreground="#727272"
- Margin="0, 0, 0, 10" />
- <Grid ColumnDefinitions="*,*" RowDefinitions="Auto,Auto" Width="300">
- <Rectangle Grid.ColumnSpan="2" Fill="#FF5722" Height="200" Margin="2.5" />
- <Rectangle Grid.Row="1" Fill="#FF5722" Height="100" Margin="2.5" />
- <Rectangle Grid.Row="1" Grid.Column="1" Fill="#FF5722" Height="100" Margin="2.5" />
- </Grid>
- <TextBlock Text="StackPanel" FontWeight="Medium" FontSize="20" Foreground="#212121" />
- <TextBlock Text="A panel which lays out its children horizontally or vertically."
- FontSize="13"
- Foreground="#727272"
- Margin="0, 0, 0, 10" />
- <StackPanel Gap="4" Width="300">
- <Rectangle Fill="#FFC107" Height="50" />
- <Rectangle Fill="#FFC107" Height="50" />
- <Rectangle Fill="#FFC107" Height="50" />
- </StackPanel>
- <TextBlock Text="WrapPanel" FontWeight="Medium" FontSize="20" Foreground="#212121" />
- <TextBlock Text="Wraps children to new lines if no space is left:"
- FontSize="13"
- Foreground="#727272"
- Margin="0, 0, 0, 10" />
- <WrapPanel>
- <Rectangle Fill="#FFC107" Height="50" Width="100" Margin="2.5" />
- <Rectangle Fill="#FFC107" Height="100" Width="100" Margin="2.5" />
- <Rectangle Fill="#FFC107" Height="50" Width="100" Margin="2.5" />
- <Rectangle Fill="#FFC107" Height="50" Width="200" Margin="2.5" />
- <Rectangle Fill="#FFC107" Height="100" Width="50" Margin="2.5" />
- <Rectangle Fill="#FFC107" Height="50" Width="100" Margin="2.5" />
- <Rectangle Fill="#FFC107" Height="50" Width="100" Margin="2.5" />
- </WrapPanel>
- <TextBlock Text="Canvas" FontWeight="Medium" FontSize="20" Foreground="#212121" />
- <TextBlock Text="A panel which lays out its children by explicit coordinates."
- FontSize="13"
- Foreground="#727272"
- Margin="0, 0, 0, 10" />
- <Canvas Width="300" Height="200" Background="Yellow">
- <Rectangle Fill="Blue" Width="63" Height="41" Canvas.Left="40" Canvas.Top="31" />
- <Rectangle Fill="Green" Width="58" Height="58" Canvas.Left="130" Canvas.Top="79" />
- </Canvas>
- <TextBlock Text="DockPanel" FontWeight="Medium" FontSize="20" Foreground="#212121" />
- <TextBlock
- Text="A panel which lays docks its children on the sides and optionally fills the remaining space with the last child"
- FontSize="13"
- Foreground="#727272"
- Margin="0, 0, 0, 10" />
- <DockPanel Width="300" Height="300">
- <Rectangle Fill="Red" Width="25" DockPanel.Dock="Left" />
- <Rectangle Fill="Green" Height="25" DockPanel.Dock="Top" />
- <Rectangle Fill="Blue" Width="25" DockPanel.Dock="Right" />
- <Rectangle Fill="Yellow" Height="25" DockPanel.Dock="Bottom" />
- <Rectangle Fill="Pink" />
- </DockPanel>
- <TextBlock Text="GridSplitter" FontWeight="Medium" FontSize="20" Foreground="#212121" />
- <Grid Height="500" Width="500" ColumnDefinitions="*,Auto,*,Auto,*" RowDefinitions="*,Auto,*">
- <Border Grid.Column="0" Grid.Row="0" Background="Red" />
- <GridSplitter Grid.Column="0" Grid.Row="1" Orientation="Horizontal" />
- <Border Grid.Column="0" Grid.Row="2" Background="Yellow" />
- <GridSplitter Grid.Column="1" Grid.RowSpan="3" Orientation="Vertical" />
- <Border Grid.Column="2" Grid.RowSpan="3" Background="Green" />
- <GridSplitter Grid.Column="3" Grid.RowSpan="3" Orientation="Vertical"/>
- <Border Grid.Column="4" Grid.Row="0" Background="Blue" />
- <GridSplitter Grid.Column="4" Grid.Row="1" Orientation="Horizontal" />
- <Border Grid.Column="4" Grid.Row="3" Background="Pink" />
- </Grid>
- </StackPanel>
- </ScrollViewer>
- </TabItem>
- <TabItem Header="Animations">
- <Grid>
- <Grid.ColumnDefinitions>
- <ColumnDefinition />
- <ColumnDefinition />
- </Grid.ColumnDefinitions>
- <Grid.RowDefinitions>
- <RowDefinition />
- <RowDefinition Height="Auto" />
- </Grid.RowDefinitions>
- <Border Width="100" Height="100">
- <Border.Background>
- <LinearGradientBrush StartPoint="0%,0%" EndPoint="100%,100%">
- <GradientStop Color="Red" Offset="0" />
- <GradientStop Color="Green" Offset="1" />
- </LinearGradientBrush>
- </Border.Background>
- <TextBox HorizontalAlignment="Center" VerticalAlignment="Center" Text="hello!"></TextBox>
- </Border>
- <Border Grid.Row="0" Grid.Column="1" Background="Coral" HorizontalAlignment="Center"
- VerticalAlignment="Center">
- <Image Width="100" Height="100" Source="github_icon.png">
- </Image>
- </Border>
- <Button Grid.Row="1" Grid.Column="1" Content="Animate" HorizontalAlignment="Center"></Button>
- </Grid>
- </TabItem>
- <TabItem Header="Brushes">
- <Grid ColumnDefinitions="Auto" RowDefinitions="Auto">
- <Border Grid.Row="0" Grid.Column="0" Width="200" Height="200" Margin="10">
- <Border.Background>
- <VisualBrush TileMode="Tile" Stretch="None" AlignmentX="Left" AlignmentY="Top" SourceRect="0%,0%,100%,100%" DestinationRect="0,0,20,20">
- <VisualBrush.Visual>
- <StackPanel Orientation="Horizontal">
- <StackPanel Orientation="Vertical">
- <Rectangle Width="10" Height="10" Fill="DarkGray"/>
- <Rectangle Width="10" Height="10" Fill="LightGray"/>
- </StackPanel>
- <StackPanel Orientation="Vertical">
- <Rectangle Width="10" Height="10" Fill="LightGray"/>
- <Rectangle Width="10" Height="10" Fill="DarkGray"/>
- </StackPanel>
- </StackPanel>
- </VisualBrush.Visual>
- </VisualBrush>
- </Border.Background>
- </Border>
- </Grid>
- </TabItem>
- <TabItem Header="IScrollable">
- <ScrollViewer>
- <local:TestScrollable/>
- </ScrollViewer>
- </TabItem>
- <TabItem Header="Mem Leak Repro">
- <Grid DataContext="{Binding Shell}">
- <StackPanel>
-
- <TabStrip Name="strip" Items="{Binding Documents}" SelectedItem="{Binding SelectedDocument, Mode=TwoWay}" Focusable="false">
- <TabStrip.Styles>
- <Style Selector="TabStripItem">
- <Setter Property="Height" Value="20" />
- <Setter Property="Background" Value="#2D2D30" />
- <Setter Property="BorderBrush" Value="#3E3E42" />
- <Setter Property="BorderThickness" Value="0" />
- <Setter Property="Margin" Value="0 0 0 -1" />
- <Setter Property="Padding" Value="4 0 4 0" />
- <Setter Property="FontSize" Value="12"/>
- </Style>
- <Style Selector="TabStripItem:pointerover">
- <Setter Property="Background" Value="#1c97ea" />
- </Style>
- <Style Selector="TabStripItem:selected">
- <Setter Property="Background" Value="#007ACC" />
- </Style>
- </TabStrip.Styles>
- <TabStrip.DataTemplates>
- <DataTemplate>
- <StackPanel Orientation="Horizontal" Gap="2">
- <TextBlock Text="{Binding Title}" Foreground="WhiteSmoke" Margin="2"/>
- <Button Height="14" Width="14">
- <Button.Styles>
- <Style Selector="Button">
- <Setter Property="BorderThickness" Value="0"/>
- <Setter Property="Padding" Value="0"/>
- <Setter Property="Margin" Value="0"/>
- <Setter Property="Background" Value="Transparent" />
- </Style>
- <Style Selector="Button:pointerover">
- <Setter Property="Background" Value="#1c97ea" />
- </Style>
- </Button.Styles>
- <Path Margin="2" Stretch="Uniform" UseLayoutRounding="False" Data="M16,12V4H17V2H7V4H8V12L6,14V16H11.2V22H12.8V16H18V14L16,12Z" Fill="WhiteSmoke" />
- </Button>
- <Button Height="14" Width="14" Command="{Binding CloseCommand}">
- <Button.Styles>
- <Style Selector="Button">
- <Setter Property="BorderThickness" Value="0"/>
- <Setter Property="Padding" Value="0"/>
- <Setter Property="Margin" Value="0"/>
- <Setter Property="Background" Value="Transparent" />
- </Style>
- <Style Selector="Button:pointerover">
- <Setter Property="Background" Value="#1c97ea" />
- </Style>
- </Button.Styles>
- <Path Margin="2" Stretch="Uniform" UseLayoutRounding="False" Data="M19,6.41L17.59,5L12,10.59L6.41,5L5,6.41L10.59,12L5,17.59L6.41,19L12,13.41L17.59,19L19,17.59L13.41,12L19,6.41Z" Fill="WhiteSmoke" />
- </Button>
- </StackPanel>
- </DataTemplate>
- </TabStrip.DataTemplates>
- </TabStrip>
- <Grid Background="#007ACC" Height="2" />
- <Button Content="AddTab" Command="{Binding AddDocumentCommand}" Width="50" Height="30" />
- <Button Content="GC.Collecy" Command="{Binding GCCommand}" Width="50" Height="30" />
- <TextBox Text="{Binding InstanceCount}" />
- <Carousel Items="{Binding Documents}" SelectedIndex="{Binding #strip.SelectedIndex}" IsVirtualized="false">
- <Carousel.DataTemplates>
- <DataTemplate>
- <TextBox Text="{Binding Text}" />
- </DataTemplate>
- </Carousel.DataTemplates>
- </Carousel>
- </StackPanel>
- </Grid>
- </TabItem>
- </TabControl>
- </Grid>
- </Window>
|