当前位置: 首页 > article >正文

WPF 元素周期表

贡献一个元素周期表页面 眼睛都写花了!!!用了不点赞祝你胖一斤。

<UserControl x:Class="***.***.Pages.Element.PeriodicElementPage"
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
      xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
      xmlns:local="clr-namespace:***.***.Pages.Element"
      xmlns:controls="clr-namespace:***.***.Controls"
      mc:Ignorable="d" 
      d:DesignHeight="1000" d:DesignWidth="1920"
      Background="#daedff" Foreground="Black">
    <UserControl.Resources>
        <Style x:Key="ElementCardButtonStyle" TargetType="{x:Type controls:ElementButton}">
            <Setter Property="Width" Value="100"/>
            <Setter Property="Height" Value="100"/>
            <Setter Property="Margin" Value="1"/>
            <Setter Property="Cursor" Value="Hand"/>
            <Setter Property="BorderBrush" Value="Transparent"/>
            <Setter Property="Background" Value="White"/>
            <Setter Property="BorderThickness" Value="1"/>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type controls:ElementButton}">
                        <Border Width="{TemplateBinding Width}" Height="{TemplateBinding Height}"
                            Background="{TemplateBinding Background}" 
                            BorderBrush="{TemplateBinding BorderBrush}" 
                            BorderThickness="{TemplateBinding BorderThickness}" 
                            CornerRadius="4">
                            <StackPanel Margin="2" HorizontalAlignment="Stretch">
                                <TextBlock FontSize="12" Text="{TemplateBinding Number}"/>
                                <TextBlock HorizontalAlignment="Center" FontSize="22" Margin="0 2 0 0" Text="{TemplateBinding Symbol}"/>
                                <TextBlock HorizontalAlignment="Center" FontSize="12" Margin="0 2 0 0" Text="{TemplateBinding Element}"/>
                                <TextBlock HorizontalAlignment="Center" FontSize="12" Margin="0 2 0 0" Text="{TemplateBinding Mass}"/>
                            </StackPanel>
                        </Border>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
            <Style.Triggers>
                <Trigger Property="IsMouseOver" Value="True">
                    <Setter Property="Background" Value="#f0f9ff"/>
                </Trigger>
                <Trigger Property="IsPressed" Value="True">
                    <Setter Property="Background" Value="#d1e9fe"/>
                </Trigger>
            </Style.Triggers>
        </Style>
        <Style x:Key="ElementBigCardButtonStyle" TargetType="{x:Type controls:ElementButton}" BasedOn="{StaticResource ElementCardButtonStyle}">
            <Setter Property="Width" Value="110"/>
            <Setter Property="Height" Value="110"/>
        </Style>
        <SolidColorBrush x:Key="jianSolidColorBrush" Color="#ff6666"/>
        <SolidColorBrush x:Key="jiantuSolidColorBrush" Color="#ffdead"/>
        <SolidColorBrush x:Key="lanSolidColorBrush" Color="#ffbfff"/>
        <SolidColorBrush x:Key="aSolidColorBrush" Color="#ff99cc"/>
        <SolidColorBrush x:Key="guoduSolidColorBrush" Color="#ffc0c0"/>
        <SolidColorBrush x:Key="houguoduSolidColorBrush" Color="#cccccc"/>
        <SolidColorBrush x:Key="leiSolidColorBrush" Color="#cccc99"/>
        <SolidColorBrush x:Key="feiSolidColorBrush" Color="#a0ffa0"/>
        <SolidColorBrush x:Key="xiyouSolidColorBrush" Color="#c0ffff"/>
    </UserControl.Resources>
    <Viewbox Stretch="Uniform">
        <Grid>
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="*"/>
            </Grid.RowDefinitions>
            <StackPanel HorizontalAlignment="Center">
                <TextBlock Text="元素周期表" FontSize="36" FontWeight="Bold" HorizontalAlignment="Center" Margin="10" Foreground="#333333"/>
                <Border Background="#c8daec" CornerRadius="8">
                    <DockPanel >
                        <DockPanel Margin="20 10 0 10">
                            <Border Width="16" Height="16" CornerRadius="4" Background="{StaticResource jianSolidColorBrush}"/>
                            <TextBlock Text="碱金属" Margin="4 0 0 0" />
                        </DockPanel>
                        <DockPanel Margin="20 10 0 10">
                            <Border Width="16" Height="16" CornerRadius="4" Background="{StaticResource jiantuSolidColorBrush}"/>
                            <TextBlock Text="碱土金属" Margin="4 0 0 0"/>
                        </DockPanel>
                        <DockPanel Margin="20 10 0 10">
                            <Border Width="16" Height="16" CornerRadius="4" Background="{StaticResource lanSolidColorBrush}"/>
                            <TextBlock Text="镧系元素" Margin="4 0 0 0"/>
                        </DockPanel>
                        <DockPanel Margin="20 10 0 10">
                            <Border Width="16" Height="16" CornerRadius="4" Background="{StaticResource aSolidColorBrush}"/>
                            <TextBlock Text="锕系元素" Margin="4 0 0 0"/>
                        </DockPanel>
                        <DockPanel Margin="20 10 0 10">
                            <Border Width="16" Height="16" CornerRadius="4" Background="{StaticResource guoduSolidColorBrush}"/>
                            <TextBlock Text="过渡金属" Margin="4 0 0 0"/>
                        </DockPanel>
                        <DockPanel Margin="20 10 0 10">
                            <Border Width="16" Height="16" CornerRadius="4" Background="{StaticResource houguoduSolidColorBrush}"/>
                            <TextBlock Text="后过渡金属" Margin="4 0 0 0"/>
                        </DockPanel>
                        <DockPanel Margin="20 10 0 10">
                            <Border Width="16" Height="16" CornerRadius="4" Background="{StaticResource leiSolidColorBrush}"/>
                            <TextBlock Text="类金属" Margin="4 0 0 0"/>
                        </DockPanel>
                        <DockPanel Margin="20 10 0 10">
                            <Border Width="16" Height="16" CornerRadius="4" Background="{StaticResource feiSolidColorBrush}"/>
                            <TextBlock Text="非金属" Margin="4 0 0 0"/>
                        </DockPanel>
                        <DockPanel Margin="20 10 20 10">
                            <Border Width="16" Height="16" CornerRadius="4" Background="{StaticResource xiyouSolidColorBrush}"/>
                            <TextBlock Text="稀有气体" Margin="4 0 0 0"/>
                        </DockPanel>
                    </DockPanel>
                </Border>
            </StackPanel>
            <Grid Grid.Row="1" Margin="10" HorizontalAlignment="Center">
                <!-- 定义周期和族的行和列 -->
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="Auto"/>
                </Grid.RowDefinitions>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto"/>
                    <ColumnDefinition Width="Auto"/>
                    <ColumnDefinition Width="Auto"/>
                    <ColumnDefinition Width="Auto"/>
                    <ColumnDefinition Width="Auto"/>
                    <ColumnDefinition Width="Auto"/>
                    <ColumnDefinition Width="Auto"/>
                    <ColumnDefinition Width="Auto"/>
                    <ColumnDefinition Width="Auto"/>
                    <ColumnDefinition Width="Auto"/>
                    <ColumnDefinition Width="Auto"/>
                    <ColumnDefinition Width="Auto"/>
                    <ColumnDefinition Width="Auto"/>
                    <ColumnDefinition Width="Auto"/>
                    <ColumnDefinition Width="Auto"/>
                    <ColumnDefinition Width="Auto"/>
                    <ColumnDefinition Width="Auto"/>
                    <ColumnDefinition Width="Auto"/>
                    <ColumnDefinition Width="Auto"/>
                </Grid.ColumnDefinitions>
                <!-- 横向序号 -->
                <TextBlock Grid.Column="1" Text="1" Margin="8" HorizontalAlignment="Center" VerticalAlignment="Center"/>
                <TextBlock Grid.Column="2" Text="2" Margin="8" HorizontalAlignment="Center" VerticalAlignment="Center"/>
                <TextBlock Grid.Column="3" Text="3" Margin="8" HorizontalAlignment="Center" VerticalAlignment="Center"/>
                <TextBlock Grid.Column="4" Text="4" Margin="8" HorizontalAlignment="Center" VerticalAlignment="Center"/>
                <TextBlock Grid.Column="5" Text="5" Margin="8" HorizontalAlignment="Center" VerticalAlignment="Center"/>
                <TextBlock Grid.Column="6" Text="6" Margin="8" HorizontalAlignment="Center" VerticalAlignment="Center"/>
                <TextBlock Grid.Column="7" Text="7" Margin="8" HorizontalAlignment="Center" VerticalAlignment="Center"/>
                <TextBlock Grid.Column="8" Text="8" Margin="8" HorizontalAlignment="Center" VerticalAlignment="Center"/>
                <TextBlock Grid.Column="9" Text="9" Margin="8" HorizontalAlignment="Center" VerticalAlignment="Center"/>
                <TextBlock Grid.Column="10" Text="10" Margin="8" HorizontalAlignment="Center" VerticalAlignment="Center"/>
                <TextBlock Grid.Column="11" Text="11" Margin="8" HorizontalAlignment="Center" VerticalAlignment="Center"/>
                <TextBlock Grid.Column="12" Text="12" Margin="8" HorizontalAlignment="Center" VerticalAlignment="Center"/>
                <TextBlock Grid.Column="13" Text="13" Margin="8" HorizontalAlignment="Center" VerticalAlignment="Center"/>
                <TextBlock Grid.Column="14" Text="14" Margin="8" HorizontalAlignment="Center" VerticalAlignment="Center"/>
                <TextBlock Grid.Column="15" Text="15" Margin="8" HorizontalAlignment="Center" VerticalAlignment="Center"/>
                <TextBlock Grid.Column="16" Text="16" Margin="8" HorizontalAlignment="Center" VerticalAlignment="Center"/>
                <TextBlock Grid.Column="17" Text="17" Margin="8" HorizontalAlignment="Center" VerticalAlignment="Center"/>
                <TextBlock Grid.Column="18" Text="18" Margin="8" HorizontalAlignment="Center" VerticalAlignment="Center"/>

                <!--第一行-->
                <TextBlock Grid.Row="1" Text="1" Margin="8" HorizontalAlignment="Center" VerticalAlignment="Center"/>
                <controls:ElementButton Grid.Row="1" Grid.Column="1"  Style="{StaticResource ElementCardButtonStyle}" Click="ElementButton_Click"  Number="1" Element="氢" Symbol="H" Mass="1.008" Background="{StaticResource feiSolidColorBrush}"/>
                <controls:ElementButton Grid.Row="1" Grid.Column="18"  Style="{StaticResource ElementCardButtonStyle}" Click="ElementButton_Click"  Number="2" Element="氦" Symbol="He" Mass="4.0026" Background="{StaticResource xiyouSolidColorBrush}"/>
                <!-- 第二行 -->
                <TextBlock Grid.Row="2" Text="2" Margin="8" HorizontalAlignment="Center" VerticalAlignment="Center"/>
                <controls:ElementButton Grid.Row="2" Grid.Column="1" Style="{StaticResource ElementCardButtonStyle}" Click="ElementButton_Click" Number="3" Element="锂" Symbol="Li" Mass="6.94" Background="{StaticResource jianSolidColorBrush}"/>
                <controls:ElementButton Grid.Row="2" Grid.Column="2" Style="{StaticResource ElementCardButtonStyle}" Click="ElementButton_Click" Number="4" Element="铍" Symbol="Be" Mass="9.0122" Background="{StaticResource jiantuSolidColorBrush}"/>
                <controls:ElementButton Grid.Row="2" Grid.Column="13" Style="{StaticResource ElementCardButtonStyle}" Click="ElementButton_Click" Number="5" Element="硼" Symbol="B" Mass="10.81" Background="{StaticResource leiSolidColorBrush}"/>
                <controls:ElementButton Grid.Row="2" Grid.Column="14" Style="{StaticResource ElementCardButtonStyle}" Click="ElementButton_Click" Number="6" Element="碳" Symbol="C" Mass="12.011" Background="{StaticResource feiSolidColorBrush}"/>
                <controls:ElementButton Grid.Row="2" Grid.Column="15" Style="{StaticResource ElementCardButtonStyle}" Click="ElementButton_Click" Number="7" Element="氮" Symbol="N" Mass="14.007" Background="{StaticResource feiSolidColorBrush}"/>
                <controls:ElementButton Grid.Row="2" Grid.Column="16" Style="{StaticResource ElementCardButtonStyle}" Click="ElementButton_Click" Number="8" Element="氧" Symbol="O" Mass="15.999" Background="{StaticResource feiSolidColorBrush}"/>
                <controls:ElementButton Grid.Row="2" Grid.Column="17" Style="{StaticResource ElementCardButtonStyle}" Click="ElementButton_Click" Number="9" Element="氟" Symbol="F" Mass="18.998" Background="{StaticResource feiSolidColorBrush}"/>
                <controls:ElementButton Grid.Row="2" Grid.Column="18" Style="{StaticResource ElementCardButtonStyle}" Click="ElementButton_Click" Number="10" Element="氖" Symbol="Ne" Mass="20.180" Background="{StaticResource xiyouSolidColorBrush}"/>

                <!-- 第三行 -->
                <TextBlock Grid.Row="3" Text="3" Margin="8" HorizontalAlignment="Center" VerticalAlignment="Center"/>
                <controls:ElementButton Grid.Row="3" Grid.Column="1" Style="{StaticResource ElementCardButtonStyle}" Click="ElementButton_Click" Number="11" Element="钠" Symbol="Na" Mass="22.990" Background="{StaticResource jianSolidColorBrush}"/>
                <controls:ElementButton Grid.Row="3" Grid.Column="2" Style="{StaticResource ElementCardButtonStyle}" Click="ElementButton_Click" Number="12" Element="镁" Symbol="Mg" Mass="24.305" Background="{StaticResource jiantuSolidColorBrush}"/>
                <controls:ElementButton Grid.Row="3" Grid.Column="13" Style="{StaticResource ElementCardButtonStyle}" Click="ElementButton_Click" Number="13" Element="铝" Symbol="Al" Mass="26.982" Background="{StaticResource houguoduSolidColorBrush}"/>
                <controls:ElementButton Grid.Row="3" Grid.Column="14" Style="{StaticResource ElementCardButtonStyle}" Click="ElementButton_Click" Number="14" Element="硅" Symbol="Si" Mass="28.085" Background="{StaticResource leiSolidColorBrush}"/>
                <controls:ElementButton Grid.Row="3" Grid.Column="15" Style="{StaticResource ElementCardButtonStyle}" Click="ElementButton_Click" Number="15" Element="磷" Symbol="P" Mass="30.974" Background="{StaticResource feiSolidColorBrush}"/>
                <controls:ElementButton Grid.Row="3" Grid.Column="16" Style="{StaticResource ElementCardButtonStyle}" Click="ElementButton_Click" Number="16" Element="硫" Symbol="S" Mass="32.06" Background="{StaticResource feiSolidColorBrush}"/>
                <controls:ElementButton Grid.Row="3" Grid.Column="17" Style="{StaticResource ElementCardButtonStyle}" Click="ElementButton_Click" Number="17" Element="氯" Symbol="Cl" Mass="35.45" Background="{StaticResource feiSolidColorBrush}"/>
                <controls:ElementButton Grid.Row="3" Grid.Column="18" Style="{StaticResource ElementCardButtonStyle}" Click="ElementButton_Click" Number="18" Element="氩" Symbol="Ar" Mass="39.948" Background="{StaticResource xiyouSolidColorBrush}"/>
                <!-- 第四行 -->
                <TextBlock Grid.Row="4" Text="4" Margin="8" HorizontalAlignment="Center" VerticalAlignment="Center"/>
                <controls:ElementButton Grid.Row="4" Grid.Column="1" Style="{StaticResource ElementCardButtonStyle}" Click="ElementButton_Click" Number="19" Element="钾" Symbol="K" Mass="39.098" Background="{StaticResource jianSolidColorBrush}"/>
                <controls:ElementButton Grid.Row="4" Grid.Column="2" Style="{StaticResource ElementCardButtonStyle}" Click="ElementButton_Click" Number="20" Element="钙" Symbol="Ca" Mass="40.078" Background="{StaticResource jiantuSolidColorBrush}"/>
                <controls:ElementButton Grid.Row="4" Grid.Column="3" Style="{StaticResource ElementCardButtonStyle}" Click="ElementButton_Click" Number="21" Element="钪" Symbol="Sc" Mass="44.956" Background="{StaticResource guoduSolidColorBrush}"/>
                <controls:ElementButton Grid.Row="4" Grid.Column="4" Style="{StaticResource ElementCardButtonStyle}" Click="ElementButton_Click" Number="22" Element="钛" Symbol="Ti" Mass="47.867" Background="{StaticResource guoduSolidColorBrush}"/>
                <controls:ElementButton Grid.Row="4" Grid.Column="5" Style="{StaticResource ElementCardButtonStyle}" Click="ElementButton_Click" Number="23" Element="钒" Symbol="V" Mass="50.941" Background="{StaticResource guoduSolidColorBrush}"/>
                <controls:ElementButton Grid.Row="4" Grid.Column="6" Style="{StaticResource ElementCardButtonStyle}" Click="ElementButton_Click" Number="24" Element="铬" Symbol="Cr" Mass="51.996" Background="{StaticResource guoduSolidColorBrush}"/>
                <controls:ElementButton Grid.Row="4" Grid.Column="7" Style="{StaticResource ElementCardButtonStyle}" Click="ElementButton_Click" Number="25" Element="锰" Symbol="Mn" Mass="54.938" Background="{StaticResource guoduSolidColorBrush}"/>
                <controls:ElementButton Grid.Row="4" Grid.Column="8" Style="{StaticResource ElementCardButtonStyle}" Click="ElementButton_Click" Number="26" Element="铁" Symbol="Fe" Mass="55.845" Background="{StaticResource guoduSolidColorBrush}"/>
                <controls:ElementButton Grid.Row="4" Grid.Column="9" Style="{StaticResource ElementCardButtonStyle}" Click="ElementButton_Click" Number="27" Element="钴" Symbol="Co" Mass="58.933" Background="{StaticResource guoduSolidColorBrush}"/>
                <controls:ElementButton Grid.Row="4" Grid.Column="10" Style="{StaticResource ElementCardButtonStyle}" Click="ElementButton_Click" Number="28" Element="镍" Symbol="Ni" Mass="58.693" Background="{StaticResource guoduSolidColorBrush}"/>
                <controls:ElementButton Grid.Row="4" Grid.Column="11" Style="{StaticResource ElementCardButtonStyle}" Click="ElementButton_Click" Number="29" Element="铜" Symbol="Cu" Mass="63.546" Background="{StaticResource guoduSolidColorBrush}"/>
                <controls:ElementButton Grid.Row="4" Grid.Column="12" Style="{StaticResource ElementCardButtonStyle}" Click="ElementButton_Click" Number="30" Element="锌" Symbol="Zn" Mass="65.38" Background="{StaticResource guoduSolidColorBrush}"/>
                <controls:ElementButton Grid.Row="4" Grid.Column="13" Style="{StaticResource ElementCardButtonStyle}" Click="ElementButton_Click" Number="31" Element="镓" Symbol="Ga" Mass="69.723" Background="{StaticResource houguoduSolidColorBrush}"/>
                <controls:ElementButton Grid.Row="4" Grid.Column="14" Style="{StaticResource ElementCardButtonStyle}" Click="ElementButton_Click" Number="32" Element="锗" Symbol="Ge" Mass="72.630" Background="{StaticResource leiSolidColorBrush}"/>
                <controls:ElementButton Grid.Row="4" Grid.Column="15" Style="{StaticResource ElementCardButtonStyle}" Click="ElementButton_Click" Number="33" Element="砷" Symbol="As" Mass="74.922" Background="{StaticResource leiSolidColorBrush}"/>
                <controls:ElementButton Grid.Row="4" Grid.Column="16" Style="{StaticResource ElementCardButtonStyle}" Click="ElementButton_Click" Number="34" Element="硒" Symbol="Se" Mass="78.971" Background="{StaticResource feiSolidColorBrush}"/>
                <controls:ElementButton Grid.Row="4" Grid.Column="17" Style="{StaticResource ElementCardButtonStyle}" Click="ElementButton_Click" Number="35" Element="溴" Symbol="Br" Mass="79.904" Background="{StaticResource feiSolidColorBrush}"/>
                <controls:ElementButton Grid.Row="4" Grid.Column="18" Style="{StaticResource ElementCardButtonStyle}" Click="ElementButton_Click" Number="36" Element="氪" Symbol="Kr" Mass="83.798" Background="{StaticResource xiyouSolidColorBrush}"/>
                <!-- 第五行 -->
                <TextBlock Grid.Row="5" Text="5" Margin="8" HorizontalAlignment="Center" VerticalAlignment="Center"/>
                <controls:ElementButton Grid.Row="5" Grid.Column="1" Style="{StaticResource ElementCardButtonStyle}" Click="ElementButton_Click" Number="37" Element="铷" Symbol="Rb" Mass="85.468" Background="{StaticResource jianSolidColorBrush}"/>
                <controls:ElementButton Grid.Row="5" Grid.Column="2" Style="{StaticResource ElementCardButtonStyle}" Click="ElementButton_Click" Number="38" Element="锶" Symbol="Sr" Mass="87.62" Background="{StaticResource jiantuSolidColorBrush}"/>
                <controls:ElementButton Grid.Row="5" Grid.Column="3" Style="{StaticResource ElementCardButtonStyle}" Click="ElementButton_Click" Number="39" Element="钇" Symbol="Y" Mass="88.906" Background="{StaticResource guoduSolidColorBrush}"/>
                <controls:ElementButton Grid.Row="5" Grid.Column="4" Style="{StaticResource ElementCardButtonStyle}" Click="ElementButton_Click" Number="40" Element="锆" Symbol="Zr" Mass="91.224" Background="{StaticResource guoduSolidColorBrush}"/>
                <controls:ElementButton Grid.Row="5" Grid.Column="5" Style="{StaticResource ElementCardButtonStyle}" Click="ElementButton_Click" Number="41" Element="铌" Symbol="Nb" Mass="92.906" Background="{StaticResource guoduSolidColorBrush}"/>
                <controls:ElementButton Grid.Row="5" Grid.Column="6" Style="{StaticResource ElementCardButtonStyle}" Click="ElementButton_Click" Number="42" Element="钼" Symbol="Mo" Mass="95.95" Background="{StaticResource guoduSolidColorBrush}"/>
                <controls:ElementButton Grid.Row="5" Grid.Column="7" Style="{StaticResource ElementCardButtonStyle}" Click="ElementButton_Click" Number="43" Element="锝" Symbol="Tc" Mass="98" Background="{StaticResource guoduSolidColorBrush}"/>
                <controls:ElementButton Grid.Row="5" Grid.Column="8" Style="{StaticResource ElementCardButtonStyle}" Click="ElementButton_Click" Number="44" Element="钌" Symbol="Ru" Mass="101.07" Background="{StaticResource guoduSolidColorBrush}"/>
                <controls:ElementButton Grid.Row="5" Grid.Column="9" Style="{StaticResource ElementCardButtonStyle}" Click="ElementButton_Click" Number="45" Element="铑" Symbol="Rh" Mass="102.91" Background="{StaticResource guoduSolidColorBrush}"/>
                <controls:ElementButton Grid.Row="5" Grid.Column="10" Style="{StaticResource ElementCardButtonStyle}" Click="ElementButton_Click" Number="46" Element="钯" Symbol="Pd" Mass="106.42" Background="{StaticResource guoduSolidColorBrush}"/>
                <controls:ElementButton Grid.Row="5" Grid.Column="11" Style="{StaticResource ElementCardButtonStyle}" Click="ElementButton_Click" Number="47" Element="银" Symbol="Ag" Mass="107.87" Background="{StaticResource guoduSolidColorBrush}"/>
                <controls:ElementButton Grid.Row="5" Grid.Column="12" Style="{StaticResource ElementCardButtonStyle}" Click="ElementButton_Click" Number="48" Element="镉" Symbol="Cd" Mass="112.41" Background="{StaticResource guoduSolidColorBrush}"/>
                <controls:ElementButton Grid.Row="5" Grid.Column="13" Style="{StaticResource ElementCardButtonStyle}" Click="ElementButton_Click" Number="49" Element="铟" Symbol="In" Mass="114.82" Background="{StaticResource houguoduSolidColorBrush}"/>
                <controls:ElementButton Grid.Row="5" Grid.Column="14" Style="{StaticResource ElementCardButtonStyle}" Click="ElementButton_Click" Number="50" Element="锡" Symbol="Sn" Mass="118.71" Background="{StaticResource houguoduSolidColorBrush}"/>
                <controls:ElementButton Grid.Row="5" Grid.Column="15" Style="{StaticResource ElementCardButtonStyle}" Click="ElementButton_Click" Number="51" Element="锑" Symbol="Sb" Mass="121.76" Background="{StaticResource leiSolidColorBrush}"/>
                <controls:ElementButton Grid.Row="5" Grid.Column="16" Style="{StaticResource ElementCardButtonStyle}" Click="ElementButton_Click" Number="52" Element="碲" Symbol="Te" Mass="127.60" Background="{StaticResource leiSolidColorBrush}"/>
                <controls:ElementButton Grid.Row="5" Grid.Column="17" Style="{StaticResource ElementCardButtonStyle}" Click="ElementButton_Click" Number="53" Element="碘" Symbol="I" Mass="126.90" Background="{StaticResource feiSolidColorBrush}"/>
                <controls:ElementButton Grid.Row="5" Grid.Column="18" Style="{StaticResource ElementCardButtonStyle}" Click="ElementButton_Click" Number="54" Element="氙" Symbol="Xe" Mass="131.293" Background="{StaticResource xiyouSolidColorBrush}"/>
                <!-- 第六行 -->
                <TextBlock Grid.Row="6" Text="6" Margin="8" HorizontalAlignment="Center" VerticalAlignment="Center"/>
                <controls:ElementButton Grid.Row="6" Grid.Column="1" Style="{StaticResource ElementCardButtonStyle}" Click="ElementButton_Click" Number="55" Element="铯" Symbol="Cs" Mass="132.91" Background="{StaticResource jianSolidColorBrush}"/>
                <controls:ElementButton Grid.Row="6" Grid.Column="2" Style="{StaticResource ElementCardButtonStyle}" Click="ElementButton_Click" Number="56" Element="钡" Symbol="Ba" Mass="137.33" Background="{StaticResource jiantuSolidColorBrush}"/>
                <controls:ElementButton Grid.Row="6" Grid.Column="3" Style="{StaticResource ElementCardButtonStyle}" Click="ElementButton_Click" Number="57" Element="镧" Symbol="La-Lu" Mass="镧系" Background="{StaticResource lanSolidColorBrush}"/>
                <controls:ElementButton Grid.Row="6" Grid.Column="4" Style="{StaticResource ElementCardButtonStyle}" Click="ElementButton_Click" Number="72" Element="铪" Symbol="Hf" Mass="178.49" Background="{StaticResource guoduSolidColorBrush}"/>
                <controls:ElementButton Grid.Row="6" Grid.Column="5" Style="{StaticResource ElementCardButtonStyle}" Click="ElementButton_Click" Number="73" Element="钽" Symbol="Ta" Mass="180.95" Background="{StaticResource guoduSolidColorBrush}"/>
                <controls:ElementButton Grid.Row="6" Grid.Column="6" Style="{StaticResource ElementCardButtonStyle}" Click="ElementButton_Click" Number="74" Element="钨" Symbol="W" Mass="183.84" Background="{StaticResource guoduSolidColorBrush}"/>
                <controls:ElementButton Grid.Row="6" Grid.Column="7" Style="{StaticResource ElementCardButtonStyle}" Click="ElementButton_Click" Number="75" Element="铼" Symbol="Re" Mass="186.21" Background="{StaticResource guoduSolidColorBrush}"/>
                <controls:ElementButton Grid.Row="6" Grid.Column="8" Style="{StaticResource ElementCardButtonStyle}" Click="ElementButton_Click" Number="76" Element="锇" Symbol="Os" Mass="190.23" Background="{StaticResource guoduSolidColorBrush}"/>
                <controls:ElementButton Grid.Row="6" Grid.Column="9" Style="{StaticResource ElementCardButtonStyle}" Click="ElementButton_Click" Number="77" Element="铱" Symbol="Ir" Mass="192.22" Background="{StaticResource guoduSolidColorBrush}"/>
                <controls:ElementButton Grid.Row="6" Grid.Column="10" Style="{StaticResource ElementCardButtonStyle}" Click="ElementButton_Click" Number="78" Element="铂" Symbol="Pt" Mass="195.08" Background="{StaticResource guoduSolidColorBrush}"/>
                <controls:ElementButton Grid.Row="6" Grid.Column="11" Style="{StaticResource ElementCardButtonStyle}" Click="ElementButton_Click" Number="79" Element="金" Symbol="Au" Mass="196.97" Background="{StaticResource guoduSolidColorBrush}"/>
                <controls:ElementButton Grid.Row="6" Grid.Column="12" Style="{StaticResource ElementCardButtonStyle}" Click="ElementButton_Click" Number="80" Element="汞" Symbol="Hg" Mass="200.59" Background="{StaticResource guoduSolidColorBrush}"/>
                <controls:ElementButton Grid.Row="6" Grid.Column="13" Style="{StaticResource ElementCardButtonStyle}" Click="ElementButton_Click" Number="81" Element="铊" Symbol="Tl" Mass="204.38" Background="{StaticResource houguoduSolidColorBrush}"/>
                <controls:ElementButton Grid.Row="6" Grid.Column="14" Style="{StaticResource ElementCardButtonStyle}" Click="ElementButton_Click" Number="82" Element="铅" Symbol="Pb" Mass="207.2" Background="{StaticResource houguoduSolidColorBrush}"/>
                <controls:ElementButton Grid.Row="6" Grid.Column="15" Style="{StaticResource ElementCardButtonStyle}" Click="ElementButton_Click" Number="83" Element="铋" Symbol="Bi" Mass="208.98" Background="{StaticResource houguoduSolidColorBrush}"/>
                <controls:ElementButton Grid.Row="6" Grid.Column="16" Style="{StaticResource ElementCardButtonStyle}" Click="ElementButton_Click" Number="84" Element="钋" Symbol="Po" Mass="209" Background="{StaticResource houguoduSolidColorBrush}"/>
                <controls:ElementButton Grid.Row="6" Grid.Column="17" Style="{StaticResource ElementCardButtonStyle}" Click="ElementButton_Click" Number="85" Element="砹" Symbol="At" Mass="210" Background="{StaticResource leiSolidColorBrush}"/>
                <controls:ElementButton Grid.Row="6" Grid.Column="18" Style="{StaticResource ElementCardButtonStyle}" Click="ElementButton_Click" Number="86" Element="氡" Symbol="Rn" Mass="222" Background="{StaticResource xiyouSolidColorBrush}"/>
                <!-- 第七行 -->
                <TextBlock Grid.Row="7" Text="7" Margin="8" HorizontalAlignment="Center" VerticalAlignment="Center"/>
                <controls:ElementButton Grid.Row="7" Grid.Column="1" Style="{StaticResource ElementCardButtonStyle}" Click="ElementButton_Click" Number="87" Element="钫" Symbol="Fr" Mass="[223]" Background="{StaticResource jianSolidColorBrush}"/>
                <controls:ElementButton Grid.Row="7" Grid.Column="2" Style="{StaticResource ElementCardButtonStyle}" Click="ElementButton_Click" Number="88" Element="镭" Symbol="Ra" Mass="[226]" Background="{StaticResource jiantuSolidColorBrush}"/>
                <controls:ElementButton Grid.Row="7" Grid.Column="3" Style="{StaticResource ElementCardButtonStyle}" Click="ElementButton_Click" Number="89" Element="锕" Symbol="Ac-Lr" Mass="锕系" Background="{StaticResource aSolidColorBrush}"/>
                <controls:ElementButton Grid.Row="7" Grid.Column="4" Style="{StaticResource ElementCardButtonStyle}" Click="ElementButton_Click" Number="104" Element="𬬻" Symbol="Rf" Mass="[267]" Background="{StaticResource guoduSolidColorBrush}"/>
                <controls:ElementButton Grid.Row="7" Grid.Column="5" Style="{StaticResource ElementCardButtonStyle}" Click="ElementButton_Click" Number="105" Element="𬭊" Symbol="Db" Mass="[268]" Background="{StaticResource guoduSolidColorBrush}"/>
                <controls:ElementButton Grid.Row="7" Grid.Column="6" Style="{StaticResource ElementCardButtonStyle}" Click="ElementButton_Click" Number="106" Element="𬭳" Symbol="Sg" Mass="[269]" Background="{StaticResource guoduSolidColorBrush}"/>
                <controls:ElementButton Grid.Row="7" Grid.Column="7" Style="{StaticResource ElementCardButtonStyle}" Click="ElementButton_Click" Number="107" Element="𬭛" Symbol="Bh" Mass="[270]" Background="{StaticResource guoduSolidColorBrush}"/>
                <controls:ElementButton Grid.Row="7" Grid.Column="8" Style="{StaticResource ElementCardButtonStyle}" Click="ElementButton_Click" Number="108" Element="𬭶" Symbol="Hs" Mass="[269]" Background="{StaticResource guoduSolidColorBrush}"/>
                <controls:ElementButton Grid.Row="7" Grid.Column="9" Style="{StaticResource ElementCardButtonStyle}" Click="ElementButton_Click" Number="109" Element="鿏" Symbol="Mt" Mass="[278]" Background="{StaticResource guoduSolidColorBrush}"/>
                <controls:ElementButton Grid.Row="7" Grid.Column="10" Style="{StaticResource ElementCardButtonStyle}" Click="ElementButton_Click" Number="110" Element="𫟼" Symbol="Ds" Mass="[281]" Background="{StaticResource guoduSolidColorBrush}"/>
                <controls:ElementButton Grid.Row="7" Grid.Column="11" Style="{StaticResource ElementCardButtonStyle}" Click="ElementButton_Click" Number="111" Element="𬬭" Symbol="Rg" Mass="[282]" Background="{StaticResource guoduSolidColorBrush}"/>
                <controls:ElementButton Grid.Row="7" Grid.Column="12" Style="{StaticResource ElementCardButtonStyle}" Click="ElementButton_Click" Number="112" Element="鿔" Symbol="Cn" Mass="[285]" Background="{StaticResource guoduSolidColorBrush}"/>
                <controls:ElementButton Grid.Row="7" Grid.Column="13" Style="{StaticResource ElementCardButtonStyle}" Click="ElementButton_Click" Number="113" Element="鉨" Symbol="Nh" Mass="[286]" Background="{StaticResource houguoduSolidColorBrush}"/>
                <controls:ElementButton Grid.Row="7" Grid.Column="14" Style="{StaticResource ElementCardButtonStyle}" Click="ElementButton_Click" Number="114" Element="𫓧" Symbol="Fl" Mass="[289]" Background="{StaticResource houguoduSolidColorBrush}"/>
                <controls:ElementButton Grid.Row="7" Grid.Column="15" Style="{StaticResource ElementCardButtonStyle}" Click="ElementButton_Click" Number="115" Element="镆" Symbol="Mc" Mass="[290]" Background="{StaticResource houguoduSolidColorBrush}"/>
                <controls:ElementButton Grid.Row="7" Grid.Column="16" Style="{StaticResource ElementCardButtonStyle}" Click="ElementButton_Click" Number="116" Element="鉝" Symbol="Lv" Mass="[293]" Background="{StaticResource houguoduSolidColorBrush}"/>
                <controls:ElementButton Grid.Row="7" Grid.Column="17" Style="{StaticResource ElementCardButtonStyle}" Click="ElementButton_Click" Number="117" Element="鿓" Symbol="Ts" Mass="[294]" Background="{StaticResource leiSolidColorBrush}"/>
                <controls:ElementButton Grid.Row="7" Grid.Column="18" Style="{StaticResource ElementCardButtonStyle}" Click="ElementButton_Click" Number="118" Element="鿬" Symbol="Og" Mass="[294]" Background="{StaticResource xiyouSolidColorBrush}"/>
                <!--LA-LU -->
                <UniformGrid Grid.Row="8" Grid.ColumnSpan="20" Grid.Column="1" Columns="15">
                    <controls:ElementButton Grid.Row="8" Grid.Column="1" Style="{StaticResource ElementBigCardButtonStyle}" Click="ElementButton_Click" Number="57" Element="镧" Symbol="La" Mass="138.91" Background="{StaticResource lanSolidColorBrush}"/>
                    <controls:ElementButton Grid.Row="8" Grid.Column="2" Style="{StaticResource ElementBigCardButtonStyle}" Click="ElementButton_Click" Number="58" Element="铈" Symbol="Ce" Mass="140.12" Background="{StaticResource lanSolidColorBrush}"/>
                    <controls:ElementButton Grid.Row="8" Grid.Column="3" Style="{StaticResource ElementBigCardButtonStyle}" Click="ElementButton_Click" Number="59" Element="镨" Symbol="Pr" Mass="140.91" Background="{StaticResource lanSolidColorBrush}"/>
                    <controls:ElementButton Grid.Row="8" Grid.Column="4" Style="{StaticResource ElementBigCardButtonStyle}" Click="ElementButton_Click" Number="60" Element="钕" Symbol="Nd" Mass="144.24" Background="{StaticResource lanSolidColorBrush}"/>
                    <controls:ElementButton Grid.Row="8" Grid.Column="5" Style="{StaticResource ElementBigCardButtonStyle}" Click="ElementButton_Click" Number="61" Element="钷" Symbol="Pm" Mass="[145]" Background="{StaticResource lanSolidColorBrush}"/>
                    <controls:ElementButton Grid.Row="8" Grid.Column="6" Style="{StaticResource ElementBigCardButtonStyle}" Click="ElementButton_Click" Number="62" Element="钐" Symbol="Sm" Mass="150.36" Background="{StaticResource lanSolidColorBrush}"/>
                    <controls:ElementButton Grid.Row="8" Grid.Column="7" Style="{StaticResource ElementBigCardButtonStyle}" Click="ElementButton_Click" Number="63" Element="铕" Symbol="Eu" Mass="151.96" Background="{StaticResource lanSolidColorBrush}"/>
                    <controls:ElementButton Grid.Row="8" Grid.Column="8" Style="{StaticResource ElementBigCardButtonStyle}" Click="ElementButton_Click" Number="64" Element="钆" Symbol="Gd" Mass="157.25" Background="{StaticResource lanSolidColorBrush}"/>
                    <controls:ElementButton Grid.Row="8" Grid.Column="9" Style="{StaticResource ElementBigCardButtonStyle}" Click="ElementButton_Click" Number="65" Element="铽" Symbol="Tb" Mass="158.93" Background="{StaticResource lanSolidColorBrush}"/>
                    <controls:ElementButton Grid.Row="8" Grid.Column="10" Style="{StaticResource ElementBigCardButtonStyle}" Click="ElementButton_Click" Number="66" Element="镝" Symbol="Dy" Mass="162.50" Background="{StaticResource lanSolidColorBrush}"/>
                    <controls:ElementButton Grid.Row="8" Grid.Column="11" Style="{StaticResource ElementBigCardButtonStyle}" Click="ElementButton_Click" Number="67" Element="钬" Symbol="Ho" Mass="164.93" Background="{StaticResource lanSolidColorBrush}"/>
                    <controls:ElementButton Grid.Row="8" Grid.Column="12" Style="{StaticResource ElementBigCardButtonStyle}" Click="ElementButton_Click" Number="68" Element="铒" Symbol="Er" Mass="167.26" Background="{StaticResource lanSolidColorBrush}"/>
                    <controls:ElementButton Grid.Row="8" Grid.Column="13" Style="{StaticResource ElementBigCardButtonStyle}" Click="ElementButton_Click" Number="69" Element="铥" Symbol="Tm" Mass="168.93" Background="{StaticResource lanSolidColorBrush}"/>
                    <controls:ElementButton Grid.Row="8" Grid.Column="14" Style="{StaticResource ElementBigCardButtonStyle}" Click="ElementButton_Click" Number="70" Element="镱" Symbol="Yb" Mass="173.05" Background="{StaticResource lanSolidColorBrush}"/>
                    <controls:ElementButton Grid.Row="8" Grid.Column="15" Style="{StaticResource ElementBigCardButtonStyle}" Click="ElementButton_Click" Number="71" Element="镥" Symbol="Lu" Mass="174.97" Background="{StaticResource lanSolidColorBrush}"/>
                </UniformGrid>
                <!--Ac-Lr -->
                <UniformGrid Grid.Row="9" Grid.ColumnSpan="20" Grid.Column="1" Columns="15">
                    <controls:ElementButton Grid.Row="9" Grid.Column="1" Style="{StaticResource ElementBigCardButtonStyle}" Click="ElementButton_Click" Number="89" Element="锕" Symbol="Ac" Mass="[227]" Background="{StaticResource aSolidColorBrush}"/>
                    <controls:ElementButton Grid.Row="9" Grid.Column="2" Style="{StaticResource ElementBigCardButtonStyle}" Click="ElementButton_Click" Number="90" Element="钍" Symbol="Th" Mass="232.04" Background="{StaticResource aSolidColorBrush}"/>
                    <controls:ElementButton Grid.Row="9" Grid.Column="3" Style="{StaticResource ElementBigCardButtonStyle}" Click="ElementButton_Click" Number="91" Element="镤" Symbol="Pa" Mass="231.04" Background="{StaticResource aSolidColorBrush}"/>
                    <controls:ElementButton Grid.Row="9" Grid.Column="4" Style="{StaticResource ElementBigCardButtonStyle}" Click="ElementButton_Click" Number="92" Element="铀" Symbol="U" Mass="238.03" Background="{StaticResource aSolidColorBrush}"/>
                    <controls:ElementButton Grid.Row="9" Grid.Column="5" Style="{StaticResource ElementBigCardButtonStyle}" Click="ElementButton_Click" Number="93" Element="镎" Symbol="Np" Mass="[237]" Background="{StaticResource aSolidColorBrush}"/>
                    <controls:ElementButton Grid.Row="9" Grid.Column="6" Style="{StaticResource ElementBigCardButtonStyle}" Click="ElementButton_Click" Number="94" Element="钚" Symbol="Pu" Mass="[244]" Background="{StaticResource aSolidColorBrush}"/>
                    <controls:ElementButton Grid.Row="9" Grid.Column="7" Style="{StaticResource ElementBigCardButtonStyle}" Click="ElementButton_Click" Number="95" Element="镅" Symbol="Am" Mass="[243]" Background="{StaticResource aSolidColorBrush}"/>
                    <controls:ElementButton Grid.Row="9" Grid.Column="8" Style="{StaticResource ElementBigCardButtonStyle}" Click="ElementButton_Click" Number="96" Element="锔" Symbol="Cm" Mass="[247]" Background="{StaticResource aSolidColorBrush}"/>
                    <controls:ElementButton Grid.Row="9" Grid.Column="9" Style="{StaticResource ElementBigCardButtonStyle}" Click="ElementButton_Click" Number="97" Element="锫" Symbol="Bk" Mass="[247]" Background="{StaticResource aSolidColorBrush}"/>
                    <controls:ElementButton Grid.Row="9" Grid.Column="10" Style="{StaticResource ElementBigCardButtonStyle}" Click="ElementButton_Click" Number="98" Element="锎" Symbol="Cf" Mass="[251]" Background="{StaticResource aSolidColorBrush}"/>
                    <controls:ElementButton Grid.Row="9" Grid.Column="11" Style="{StaticResource ElementBigCardButtonStyle}" Click="ElementButton_Click" Number="99" Element="锿" Symbol="Es" Mass="[252]" Background="{StaticResource aSolidColorBrush}"/>
                    <controls:ElementButton Grid.Row="9" Grid.Column="12" Style="{StaticResource ElementBigCardButtonStyle}" Click="ElementButton_Click" Number="100" Element="镄" Symbol="Fm" Mass="[257]" Background="{StaticResource aSolidColorBrush}"/>
                    <controls:ElementButton Grid.Row="9" Grid.Column="13" Style="{StaticResource ElementBigCardButtonStyle}" Click="ElementButton_Click" Number="101" Element="钔" Symbol="Md" Mass="[258]" Background="{StaticResource aSolidColorBrush}"/>
                    <controls:ElementButton Grid.Row="9" Grid.Column="14" Style="{StaticResource ElementBigCardButtonStyle}" Click="ElementButton_Click" Number="102" Element="锘" Symbol="No" Mass="[259]" Background="{StaticResource aSolidColorBrush}"/>
                    <controls:ElementButton Grid.Row="9" Grid.Column="15" Style="{StaticResource ElementBigCardButtonStyle}" Click="ElementButton_Click" Number="103" Element="铹" Symbol="Lr" Mass="[266]" Background="{StaticResource aSolidColorBrush}"/>
                </UniformGrid>
            </Grid>
        </Grid>
    </Viewbox>
</UserControl>

 

 public class ElementButton : Button
 {
     static ElementButton()
     {
         DefaultStyleKeyProperty.OverrideMetadata(typeof(ElementButton), new FrameworkPropertyMetadata(typeof(ElementButton)));
     }

     public static readonly DependencyProperty SymbolProperty = DependencyProperty.Register("Symbol", typeof(string), typeof(ElementButton), new PropertyMetadata(string.Empty));
     public static readonly DependencyProperty ElementProperty = DependencyProperty.Register("Element", typeof(string), typeof(ElementButton), new PropertyMetadata(string.Empty));
     public static readonly DependencyProperty MassProperty = DependencyProperty.Register("Mass", typeof(string), typeof(ElementButton), new PropertyMetadata(string.Empty));
     public static readonly DependencyProperty NumberProperty = DependencyProperty.Register("Number", typeof(string), typeof(ElementButton), new PropertyMetadata(string.Empty));
     public string Symbol
     {
         get { return (string)GetValue(SymbolProperty); }
         set { SetValue(SymbolProperty, value); }
     }

     public string Element
     {
         get { return (string)GetValue(ElementProperty); }
         set { SetValue(ElementProperty, value); }
     }
     public string Number
     {
         get { return (string)GetValue(NumberProperty); }
         set { SetValue(NumberProperty, value); }
     }
     public string Mass
     {
         get { return (string)GetValue(MassProperty); }
         set { SetValue(MassProperty, value); }
     }
 }


http://www.kler.cn/a/581240.html

相关文章:

  • c++学习之QT综合项目一
  • Vue使用ScreenFull插件实现全屏切换
  • 基于STM32的智能家居门禁开锁控制系统(论文+源码)
  • 可复用的 Vue 轮播图组件
  • Unity 基础知识总结(持续更新中...)
  • SwiftUI 让视图自适应高度的 6 种方法(四)
  • 03_NLP常用的文本数据分析处理方法
  • 【AI落地应用实战】RAGFlow + 知识图谱Knowledge Graph + Deepseek + 知识库构建初步探索
  • Codeforces Round 1008 (Div. 2)(A-D)
  • Application.OnTime如何引用带参数的过程
  • 数据篇| App爬虫入门(一)
  • Python数据分析之机器学习基础
  • WinForm模态与非模态窗体
  • 刚刚!微调 DeepSeek 满血版正式开源。。。
  • 基于PyTorch的深度学习——机器学习3
  • 运维无忧:NebulaGraph Dashboard—— 集群监控的可视化神兵
  • okhttp源码解析
  • 【leetcode100】分割回文串
  • 流处理实战:Flink 在实时数据处理中的应用(状态管理、Watermark、窗口计算)
  • cesium1.126显示等高线