1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
<ListView Name="ImageListView" Foreground="{x:Null}">        
        <ListBox.ItemContainerStyle>
            <Style TargetType="ListBoxItem">
                <Style.Triggers>
                    <Trigger Property="IsSelected" Value="True" >
                        <Setter Property="FontWeight" Value="Bold" />
                        <Setter Property="Background" Value="Transparent" />
                        <Setter Property="Foreground" Value="Black" />
                        <Setter Property="BorderBrush" Value="Coral" />
                        <Setter Property="BorderThickness" Value="2" />
                    </Trigger>
                </Style.Triggers>
                <Style.Resources>
                    <SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" Color="Transparent"/>
                    <SolidColorBrush x:Key="{x:Static SystemColors.ControlBrushKey}" Color="Transparent"/>
                </Style.Resources>
            </Style>
        </ListBox.ItemContainerStyle>
</ListView>

XAML 코드

1
2
3
4
5
6
7
<ListView Name="ImageListView" ScrollViewer.CanContentScroll="False">        
        <ListBox.ItemContainerStyle>
            <Style TargetType="ListBoxItem">
                <EventSetter Event="RequestBringIntoView" Handler="ListBoxItemRequestBringIntoView"/>
            </Style>
        </ListBox.ItemContainerStyle>
</ListView>


CS 코드

1
2
3
4
private void ListBoxItemRequestBringIntoView(object sender , RequestBringIntoViewEventArgs e)
{
    e.Handled = true;
}


Ctrl + a 의 경우 해당 component에 KeyDown event로써 발생하게 되어 있다.


다음과 같은 EventHandler를 등록 시키면 사용이 가능하다.


 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
private void textBox_KeyDown(object sender, KeyEventArgs e)
{
    if (e.Control)
    {
        if (e.KeyCode == Keys.A)
        {
            this.textBoxPlainText.Focus();
            this.textBoxPlainText.SelectAll();
        }
    }
}


+ Recent posts