Location>code7788 >text

An example of WPF rotary board stack design

Popularity:814 ℃/2025-04-11 16:23:34
1 <UserControl x:Class="" 2 xmlns="/winfx/2006/xaml/presentation" 3 xmlns:x="/winfx/2006/xaml" 4 xmlns:mc="/markup-compatibility/2006" 5 xmlns:d="/expression/blend/2008" 6 xmlns:b="/xaml/behaviors" 7 xmlns:local="clr-namespace:" 8 xmlns:wpfapp1="clr-namespace:WpfApp1" 9 d:DataContext="{d:DesignInstance Type=wpfapp1:MainViewModel}" 10 Width="224" Height="300" 11 mc:Ignorable="d" 12 d:DesignHeight="300" d:DesignWidth="250"> 13 <> 14 <wpfapp1:MainViewModel /> 15 </> 16 <Grid> 17 <!--<ItemsControl ItemsSource="{Binding NestGroups}"> 18 <> 19 <ItemsPanelTemplate> 20 <StackPanel Orientation="Horizontal"></StackPanel> 21 </ItemsPanelTemplate> 22 </> 23 <> 24 <DataTemplate>--> 25 <Border Margin="1"> 26 <Grid Width="220" Height="220"> 27 <Ellipse Stroke="#dcdfe3" StrokeThickness="3" Width="220" Height="220"/> 28 <Ellipse Stroke="#dcdfe3" StrokeThickness="3" Width="80" Height="80" HorizontalAlignment="Center" VerticalAlignment="Center"/> 29 <ItemsControl ItemsSource="{Binding LeftTubes3}"> 30 <> 31 <ItemsPanelTemplate> 32 <Canvas/> 33 </ItemsPanelTemplate> 34 </> 35 <> 36 <Style TargetType="ContentPresenter"> 37 <Setter Property="" Value="{Binding X, Mode=OneWay}"/> 38 <Setter Property="" Value="{Binding Y, Mode=OneWay}"/> 39 <Setter Property="RenderTransformOrigin" Value="0.5,0.5"/> 40 <Setter Property="RenderTransform"> 41 <> 42 <RotateTransform Angle="{Binding Angle}"/> 43 </> 44 </Setter> 45 </Style> 46 </> 47 <> 48 <DataTemplate> 49 <Grid> 50 <Border Width="35" Height="50" Tag="{Binding .}" x:Name="animatedBorder" MouseLeftButtonDown="Border_MouseLeftButtonDown" 51 CornerRadius="3" Background="#FFE6E6E6" BorderBrush="Gray" BorderThickness="1"> 52 <ItemsControl ItemsSource="{Binding Tubes}" Margin="2" IsHitTestVisible="False"> 53 <> 54 <ItemsPanelTemplate> 55 <UniformGrid Columns="{Binding Rows}" Rows="{Binding Cols}" IsHitTestVisible="False"/> 56 </ItemsPanelTemplate> 57 </> 58 <> 59 <DataTemplate> 60 <Ellipse Width="{Binding Width}" Height="{Binding Height}" Fill="#FF4F81BD" Margin="{Binding Margin}" Stroke="Black" StrokeThickness="0.5" IsHitTestVisible="False"/> 61 </DataTemplate> 62 </> 63 </ItemsControl> 64 <> 65 <EventTrigger RoutedEvent="MouseLeftButtonUp"> 66 <BeginStoryboard> 67 <Storyboard> 68 <DoubleAnimation ="Opacity" From="1" To="0.5" Duration="0:0:0.1" AutoReverse="True"/> 69 </Storyboard> 70 </BeginStoryboard> 71 </EventTrigger> 72 </> 73 </Border> 74 <Border Width="20" Height="20" CornerRadius="10" Background="#FF4F81BD" BorderBrush="White" BorderThickness="1" HorizontalAlignment="Center" VerticalAlignment="Top" Margin="0,-10,0,0"> 75 <TextBlock Text="{Binding Index}" Foreground="White" FontWeight="Bold" HorizontalAlignment="Center" VerticalAlignment="Center"/> 76 </Border> 77 </Grid> 78 </DataTemplate> 79 </> 80 </ItemsControl> 81 </Grid> 82 </Border> 83 <!--</DataTemplate> 84 </> 85 </ItemsControl>--> 86 87 </Grid> 88 </UserControl> 89 90