combobox design verbessern

This commit is contained in:
younes elhaddoury
2026-02-25 10:08:33 +01:00
parent 95f71e34c7
commit 41da8b7a54

View File

@@ -27,7 +27,6 @@
</Border> </Border>
<StackPanel Grid.Row="1" Grid.Column="0" Background="{DynamicResource SidebarBackground}"> <StackPanel Grid.Row="1" Grid.Column="0" Background="{DynamicResource SidebarBackground}">
<Button Height="50" Margin="5" Click="HomeButton_Click" Background="Transparent" BorderThickness="0"> <Button Height="50" Margin="5" Click="HomeButton_Click" Background="Transparent" BorderThickness="0">
<StackPanel Orientation="Horizontal"> <StackPanel Orientation="Horizontal">
<iconPacks:PackIconMaterial Kind="Home" Width="20" Margin="0,0,10,0" Foreground="{DynamicResource PrimaryText}"/> <iconPacks:PackIconMaterial Kind="Home" Width="20" Margin="0,0,10,0" Foreground="{DynamicResource PrimaryText}"/>
@@ -106,25 +105,103 @@
<StackPanel Orientation="Horizontal" VerticalAlignment="Center"> <StackPanel Orientation="Horizontal" VerticalAlignment="Center">
<iconPacks:PackIconMaterial Kind="Translate" <iconPacks:PackIconMaterial Kind="Translate"
Width="32" Width="32" Height="32"
Height="32"
Foreground="{DynamicResource PrimaryText}" Foreground="{DynamicResource PrimaryText}"
Margin="0,0,15,0"/> Margin="0,0,15,0"/>
<StackPanel Width="300"> <StackPanel Width="300">
<TextBlock Text="{x:Static properties:Resources.Language}" <TextBlock Text="{x:Static properties:Resources.Language}"
FontSize="18" FontSize="18" FontWeight="Bold"
FontWeight="Bold" Foreground="{DynamicResource PrimaryText}"/>
Foreground="{DynamicResource PrimaryText}"/>
<TextBlock Text="{x:Static properties:Resources.ChooseLanguage}" <TextBlock Text="{x:Static properties:Resources.ChooseLanguage}"
FontSize="14" FontSize="14" Foreground="{DynamicResource SecondaryText}"/>
Foreground="{DynamicResource SecondaryText}"/>
</StackPanel> </StackPanel>
<ComboBox x:Name="LanguageComboBox" <ComboBox x:Name="LanguageComboBox"
Width="150" Width="150" Height="40"
SelectionChanged="LanguageComboBox_SelectionChanged"> SelectionChanged="LanguageComboBox_SelectionChanged">
<ComboBox.Style>
<Style TargetType="ComboBox">
<Setter Property="Background" Value="#1E88E5"/>
<Setter Property="Foreground" Value="White"/>
<Setter Property="FontWeight" Value="SemiBold"/>
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ComboBox">
<Grid>
<ToggleButton x:Name="ToggleButton"
Grid.Column="2"
Focusable="false"
IsChecked="{Binding Path=IsDropDownOpen,Mode=TwoWay,RelativeSource={RelativeSource TemplatedParent}}">
<ToggleButton.Template>
<ControlTemplate TargetType="ToggleButton">
<Border CornerRadius="8" Background="{TemplateBinding Background}" BorderThickness="0">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition Width="40" />
</Grid.ColumnDefinitions>
<iconPacks:PackIconMaterial Kind="ChevronDown"
Foreground="White"
Grid.Column="1"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Width="14" Height="14"/>
</Grid>
</Border>
</ControlTemplate>
</ToggleButton.Template>
</ToggleButton>
<ContentPresenter x:Name="ContentSite"
IsHitTestVisible="False"
Content="{TemplateBinding SelectionBoxItem}"
Margin="15,0,40,0"
VerticalAlignment="Center"
HorizontalAlignment="Left"
TextBlock.Foreground="White" />
<Popup x:Name="Popup" Placement="Bottom" IsOpen="{TemplateBinding IsDropDownOpen}" AllowsTransparency="True" Focusable="False" PopupAnimation="Slide">
<Grid x:Name="DropDown" SnapsToDevicePixels="True" MinWidth="{TemplateBinding ActualWidth}" MaxHeight="200">
<Border x:Name="DropDownBorder" Background="{DynamicResource CardBackground}" BorderThickness="1" BorderBrush="#1E88E5" CornerRadius="8" Margin="0,5,0,0">
<ScrollViewer Margin="4,6,4,6" SnapsToDevicePixels="True">
<StackPanel IsItemsHost="True" KeyboardNavigation.DirectionalNavigation="Contained" />
</ScrollViewer>
</Border>
</Grid>
</Popup>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ComboBox.Style>
<ComboBox.ItemContainerStyle>
<Style TargetType="ComboBoxItem">
<Setter Property="Padding" Value="12,10"/>
<Setter Property="Foreground" Value="{DynamicResource PrimaryText}"/>
<Setter Property="Background" Value="Transparent"/>
<Setter Property="Cursor" Value="Hand"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ComboBoxItem">
<Border x:Name="Bd" Background="{TemplateBinding Background}" CornerRadius="6" Padding="{TemplateBinding Padding}">
<ContentPresenter HorizontalAlignment="Left" VerticalAlignment="Center"/>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsHighlighted" Value="True">
<Setter TargetName="Bd" Property="Background" Value="#1E88E5"/>
<Setter Property="Foreground" Value="White"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ComboBox.ItemContainerStyle>
<ComboBoxItem Content="Deutsch" Tag="de"/> <ComboBoxItem Content="Deutsch" Tag="de"/>
<ComboBoxItem Content="English" Tag="en"/> <ComboBoxItem Content="English" Tag="en"/>
<ComboBoxItem Content="Українська" Tag="uk"/> <ComboBoxItem Content="Українська" Tag="uk"/>