43 lines
1.6 KiB
XML
43 lines
1.6 KiB
XML
<UserControl xmlns="https://github.com/avaloniaui"
|
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
|
xmlns:conv="clr-namespace:Project_Periodensystem.View.Converters"
|
|
x:Class="Project_Periodensystem.View.Components.ElementTile"
|
|
Width="80" Height="80"
|
|
RenderTransformOrigin="0.5,0.5">
|
|
|
|
<!-- 1) Converter registrieren -->
|
|
<UserControl.Resources>
|
|
<conv:BoolToScaleXConverter x:Key="FlipConverter"/>
|
|
<conv:SeriesToColorConverter x:Key="SeriesToColorConverter"/>
|
|
</UserControl.Resources>
|
|
|
|
<!-- (optional) Flip-Transform beibehalten -->
|
|
<UserControl.RenderTransform>
|
|
<ScaleTransform
|
|
ScaleX="{Binding IsFlipped, Converter={StaticResource FlipConverter}}"
|
|
ScaleY="1"/>
|
|
</UserControl.RenderTransform>
|
|
|
|
<!-- 2) Border.Background an die Series binden -->
|
|
<Border CornerRadius="4" Padding="4"
|
|
Background="{Binding Series, Converter={StaticResource SeriesToColorConverter}}">
|
|
<Grid>
|
|
<StackPanel>
|
|
<TextBlock Text="{Binding AtomicNumber}"
|
|
FontSize="10"
|
|
Foreground="White"
|
|
HorizontalAlignment="Right"/>
|
|
<TextBlock Text="{Binding Symbol}"
|
|
FontSize="24"
|
|
FontWeight="Bold"
|
|
Foreground="White"
|
|
HorizontalAlignment="Center"/>
|
|
<TextBlock Text="{Binding ElementName}"
|
|
FontSize="10"
|
|
Foreground="White"
|
|
HorizontalAlignment="Center"/>
|
|
</StackPanel>
|
|
</Grid>
|
|
</Border>
|
|
</UserControl>
|