MainWindow.xaml 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. <cc:WaaaghWindow x:Class="WpfSample.MainWindow"
  2. xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  3. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  4. xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
  5. xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
  6. xmlns:local="clr-namespace:WpfSample"
  7. xmlns:vm="clr-namespace:WpfSample.ViewModels"
  8. xmlns:attach="clr-namespace:Waaagh.Behaviors;assembly=Waaagh"
  9. xmlns:cc="clr-namespace:Waaagh.CustomControl;assembly=Waaagh"
  10. xmlns:james="https://jamesnet.dev/xaml/presentation"
  11. mc:Ignorable="d"
  12. Title="MainWindow" Height="450" Width="800">
  13. <Window.DataContext>
  14. <vm:MainViewModel/>
  15. </Window.DataContext>
  16. <TabControl>
  17. <TabItem Header="TEst">
  18. <cc:NavigationBar>
  19. <ListBoxItem Content="Microsoft" Tag="{x:Static james:IconType.Microsoft}"/>
  20. <ListBoxItem Content="Apple" Tag="{x:Static james:IconType.Apple}"/>
  21. <ListBoxItem Content="Google" Tag="{x:Static james:IconType.Google}"/>
  22. <ListBoxItem Content="Facebook" Tag="{x:Static james:IconType.Facebook}"/>
  23. <ListBoxItem Content="Instagram" Tag="{x:Static james:IconType.Instagram}"/>
  24. </cc:NavigationBar>
  25. </TabItem>
  26. <TabItem Header="Animation">
  27. <Rectangle x:Name="TestRectangle" Width="100" Height="100" Fill="Coral">
  28. <Rectangle.Triggers>
  29. <EventTrigger RoutedEvent="Rectangle.Loaded">
  30. <BeginStoryboard>
  31. <Storyboard>
  32. <DoubleAnimation Storyboard.TargetName="TestRectangle" Storyboard.TargetProperty="Opacity"
  33. Duration="0:0:2" From="1.0" To="0.0" AutoReverse="True" RepeatBehavior="Forever"/>
  34. </Storyboard>
  35. </BeginStoryboard>
  36. </EventTrigger>
  37. </Rectangle.Triggers>
  38. </Rectangle>
  39. </TabItem>
  40. <TabItem Header="WaaaghTheme">
  41. <Grid ShowGridLines="True">
  42. <Grid.RowDefinitions>
  43. <RowDefinition Height="*"/>
  44. <RowDefinition Height="32"/>
  45. </Grid.RowDefinitions>
  46. <Border Grid.Row="0" Background="{DynamicResource BackgroundBrush}">
  47. <TextBlock FontSize="32" FontWeight="Bold" HorizontalAlignment="Center" VerticalAlignment="Center" Text="Greeting" Foreground="{DynamicResource ForegroundBrush}"/>
  48. </Border>
  49. <StackPanel Grid.Row="1" Orientation="Horizontal">
  50. <Button Content="Dark" Click="DarkThemeButton_Click"/>
  51. <Button Content="Light" Click="LightThemeButton_Click"/>
  52. </StackPanel>
  53. </Grid>
  54. </TabItem>
  55. <TabItem Header="ItemsDraggable">
  56. <Grid>
  57. <Grid.RowDefinitions>
  58. <RowDefinition Height="36"/>
  59. <RowDefinition Height="*"/>
  60. </Grid.RowDefinitions>
  61. <StackPanel Grid.Row="0" Orientation="Horizontal">
  62. <Button Command="{Binding AddGroupCommand}" Content="AddGroup"/>
  63. <Button Command="{Binding AddItemCommand}" Content="AddItem"/>
  64. </StackPanel>
  65. <UniformGrid Grid.Row="1" Columns="4">
  66. <UniformGrid.Resources>
  67. <HierarchicalDataTemplate DataType="{x:Type vm:DemoGroupViewModel}" ItemsSource="{Binding Items}">
  68. <Border Background="Coral">
  69. <TextBlock>
  70. <TextBlock.Text>
  71. <MultiBinding StringFormat="{}{0}-{1}">
  72. <Binding Path="Index"/>
  73. <Binding Path="Name"/>
  74. </MultiBinding>
  75. </TextBlock.Text>
  76. </TextBlock>
  77. </Border>
  78. </HierarchicalDataTemplate>
  79. <HierarchicalDataTemplate DataType="{x:Type vm:DemoItemViewModel}">
  80. <Border Background="#669999">
  81. <TextBlock Text="{Binding Message}"/>
  82. </Border>
  83. </HierarchicalDataTemplate>
  84. </UniformGrid.Resources>
  85. <TreeView ItemsSource="{Binding Groups}"
  86. attach:ItemsDraggable.Enabled="True"
  87. attach:ItemsDraggable.DoMoveEffect="{Binding DoMoveEffectFunc}"/>
  88. <TreeView ItemsSource="{Binding Groups}"
  89. attach:ItemsDraggable.Enabled="True"
  90. attach:ItemsDraggable.DoMoveEffect="{Binding DoMoveEffectFunc}"/>
  91. <TreeView ItemsSource="{Binding Groups2}"
  92. attach:ItemsDraggable.Enabled="True"
  93. attach:ItemsDraggable.DoMoveEffect="{Binding DoMoveEffectFunc}"/>
  94. <TreeView ItemsSource="{Binding Groups2}"
  95. attach:ItemsDraggable.Enabled="True"
  96. attach:ItemsDraggable.DoMoveEffect="{Binding DoMoveEffectFunc}"/>
  97. </UniformGrid>
  98. </Grid>
  99. </TabItem>
  100. </TabControl>
  101. </cc:WaaaghWindow>