Style - <ComboBox>

Eden·2023년 2월 22일
0
    <Style x:Key="Combobox.Arrow.Down" TargetType="{x:Type Path}"> //아래 화살표 Path
        <Setter Property="Data" Value="M0.999,0.0 L0.0,0.999 L5.0,6.0 L10.0,0.999 L9.0,0.0 L5.0,4.0 L0.999,0.0 Z"/>
        <Setter Property="Width" Value="10"/>
        <Setter Property="Height" Value="6"/>
    </Style>
    <Style x:Key="Combobox.Arrow.Up" TargetType="{x:Type Path}"> //위 화살표 Path
        <Setter Property="Data" Value="M0.999,6.0 L0.0,5.0 L5.0,0.0 L10.0,5.0 L9.0,6.0 L5.0,1.999 L0.999,6.0 Z"/>
        <Setter Property="Width" Value="10"/>
        <Setter Property="Height" Value="6"/>
    </Style>
    
    <DropShadowEffect x:Key="ComboBoxItemShadow" Color="#000000" Opacity="0.4" Direction="270" ShadowDepth="1" BlurRadius="2"/> //ComboBoxItem에 쓰일 그림자 효과
    
    <Style x:Key="ComboBox.Toggle" TargetType="{x:Type ToggleButton}"> // 콤보박스가 
        <Setter Property="Background" Value="{StaticResource Secondary.1}"/>
        <Setter Property="ClickMode" Value="Press"/>
        <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
        <Setter Property="Foreground" Value="{StaticResource Foreground.5}"/>
        <Setter Property="OverridesDefaultStyle" Value="True"/>
        <Setter Property="SnapsToDevicePixels" Value="True"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ToggleButton}">
                    <Grid x:Name="Root" Background="Transparent">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition x:Name="ColumnContent" Width="*"/>
                            <ColumnDefinition x:Name="ColumnButton" Width="24"/>
                        </Grid.ColumnDefinitions>
                        <Grid Grid.ColumnSpan="2">
                            <Border x:Name="IsDefault" Background="{TemplateBinding Background}" BorderBrush="Transparent" BorderThickness="0" CornerRadius="2"/>
                            <Border x:Name="StateContainer" Opacity="0" CornerRadius="2"/>
                        </Grid>
                        <Grid Grid.Column="1">
                            <Path x:Name="ArrowDown" Fill="{TemplateBinding Foreground}" Margin="6,9" VerticalAlignment="Center" Style="{StaticResource Combobox.Arrow.Down}"/>
                            <Path x:Name="ArrowUp" Fill="{TemplateBinding Foreground}" Margin="6,9" VerticalAlignment="Center" Style="{StaticResource Combobox.Arrow.Up}" Visibility="Collapsed"/>
                        </Grid>
                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsMouseOver" Value="True">
                            <Setter Property="Background" TargetName="StateContainer" Value="{StaticResource Primary.Dark.900}"/>
                            <Setter Property="Opacity" TargetName="StateContainer" Value="0.6"/>
                        </Trigger>
                        <Trigger Property="IsPressed" Value="True">
                        </Trigger>
                        <Trigger Property="IsChecked" Value="True">
                            <Setter Property="Visibility" TargetName="ArrowUp" Value="Visible"/>
                            <Setter Property="Visibility" TargetName="ArrowDown" Value="Collapsed"/>
                        </Trigger>
                        <Trigger Property="IsEnabled" Value="False">
                            <Setter Property="Fill" TargetName="ArrowDown" Value="{StaticResource Foreground.Disabled}"/>
                            <Setter Property="Fill" TargetName="ArrowUp" Value="{StaticResource Foreground.Disabled}"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    
profile
주섬주섬..

0개의 댓글