Melhorias de usabilidade e aparência no ListView
Adicionadas funcionalidades de manipulação de eventos de clique do mouse
(`PreviewMouseLeftButtonDown` e `PreviewMouseRightButtonDown`) e suporte
para copiar informações do `ListView` com atalhos de teclado (`Ctrl+C`) e
menu de contexto ("Copiar coluna"). Implementado com `InputBindings`,
`CommandBindings` e `ContextMenu`.
Alterada a exibição das colunas do `GridView` para usar `TextBox` somente
leitura, permitindo seleção de texto, com customizações visuais como
cor de texto (`Foreground="#FF042271"`), fundo transparente e sem bordas.
Adicionado estilo personalizado para itens do `ListView`, incluindo
captura de eventos de tecla pressionada (`KeyDown`) e remoção do evento
de clique duplo do mouse (`MouseDoubleClick`).
Atualizadas colunas adicionais (`Unidade`, `Instalação`, `CNPJ`, `Razão
Social`) para seguir o mesmo padrão de somente leitura e aparência.
Essas mudanças melhoram a experiência do usuário, tornando a interface
mais prática e visualmente consistente.
This commit is contained in:
parent
2f1c28e482
commit
62a3830716
@ -56,13 +56,65 @@
|
|||||||
<RowDefinition Height="*" />
|
<RowDefinition Height="*" />
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
<TextBlock Text="Empresas:" Margin="10,0,10,0" FontWeight="Bold" Grid.Row="0"/>
|
<TextBlock Text="Empresas:" Margin="10,0,10,0" FontWeight="Bold" Grid.Row="0"/>
|
||||||
<ListView ItemsSource="{Binding Clientes}" Height="213" Margin="10" SelectedItem="{Binding SelectedCliente, Mode=TwoWay}" Grid.Row="1">
|
<ListView ItemsSource="{Binding Clientes}" Height="213" Margin="10" SelectedItem="{Binding SelectedCliente, Mode=TwoWay}" Grid.Row="1"
|
||||||
|
PreviewMouseLeftButtonDown="UnidadesListView_PreviewMouseLeftButtonDown"
|
||||||
|
PreviewMouseRightButtonDown="UnidadesListView_PreviewMouseRightButtonDown">
|
||||||
|
<ListView.InputBindings>
|
||||||
|
<KeyBinding Key="C" Modifiers="Control" Command="ApplicationCommands.Copy"/>
|
||||||
|
</ListView.InputBindings>
|
||||||
|
<ListView.CommandBindings>
|
||||||
|
<CommandBinding Command="ApplicationCommands.Copy" Executed="CopyCommand_Executed"/>
|
||||||
|
</ListView.CommandBindings>
|
||||||
|
<ListView.ContextMenu>
|
||||||
|
<ContextMenu>
|
||||||
|
<MenuItem Header="Copiar coluna" Click="CopyMenu_Click"/>
|
||||||
|
</ContextMenu>
|
||||||
|
</ListView.ContextMenu>
|
||||||
<ListView.View>
|
<ListView.View>
|
||||||
<GridView>
|
<GridView>
|
||||||
<GridViewColumn Header="Gestão" DisplayMemberBinding="{Binding Gestao}" Width="70" />
|
<!-- Demais colunas (TextBox readonly para seleção) -->
|
||||||
<GridViewColumn Header="Cliente" DisplayMemberBinding="{Binding Cliente}" Width="400" />
|
<GridViewColumn Header="Gestão" Width="70">
|
||||||
|
<GridViewColumn.CellTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
<TextBox Text="{Binding Gestao}"
|
||||||
|
IsReadOnly="True"
|
||||||
|
Foreground="#FF042271"
|
||||||
|
BorderThickness="0"
|
||||||
|
Background="Transparent"
|
||||||
|
Padding="0"
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
HorizontalAlignment="Left"
|
||||||
|
Cursor="IBeam"
|
||||||
|
Focusable="True"/>
|
||||||
|
</DataTemplate>
|
||||||
|
</GridViewColumn.CellTemplate>
|
||||||
|
</GridViewColumn>
|
||||||
|
<!-- Demais colunas (TextBox readonly para seleção) -->
|
||||||
|
<GridViewColumn Header="Cliente" Width="400">
|
||||||
|
<GridViewColumn.CellTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
<TextBox Text="{Binding Cliente}"
|
||||||
|
IsReadOnly="True"
|
||||||
|
Foreground="#FF042271"
|
||||||
|
BorderThickness="0"
|
||||||
|
Background="Transparent"
|
||||||
|
Padding="0"
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
HorizontalAlignment="Left"
|
||||||
|
Cursor="IBeam"
|
||||||
|
Focusable="True"/>
|
||||||
|
</DataTemplate>
|
||||||
|
</GridViewColumn.CellTemplate>
|
||||||
|
</GridViewColumn>
|
||||||
</GridView>
|
</GridView>
|
||||||
</ListView.View>
|
</ListView.View>
|
||||||
|
<ListView.ItemContainerStyle>
|
||||||
|
<Style TargetType="ListViewItem">
|
||||||
|
<!-- removido MouseDoubleClick -->
|
||||||
|
<!--<EventSetter Event="MouseDoubleClick" Handler="UnidadeListView_MouseDoubleClick" />-->
|
||||||
|
<EventSetter Event="KeyDown" Handler="UnidadeListView_EnterKeyDown" />
|
||||||
|
</Style>
|
||||||
|
</ListView.ItemContainerStyle>
|
||||||
</ListView>
|
</ListView>
|
||||||
<Grid Visibility="{Binding IsLoading, Converter={StaticResource BoolToVisibilityConverter}}"
|
<Grid Visibility="{Binding IsLoading, Converter={StaticResource BoolToVisibilityConverter}}"
|
||||||
Background="#80FFFFFF">
|
Background="#80FFFFFF">
|
||||||
@ -122,6 +174,7 @@
|
|||||||
BorderThickness="0"
|
BorderThickness="0"
|
||||||
Background="Transparent"
|
Background="Transparent"
|
||||||
Cursor="Hand"
|
Cursor="Hand"
|
||||||
|
Foreground="#FF042271"
|
||||||
HorizontalAlignment="Center"
|
HorizontalAlignment="Center"
|
||||||
VerticalAlignment="Center"
|
VerticalAlignment="Center"
|
||||||
DataContext="{Binding}">
|
DataContext="{Binding}">
|
||||||
@ -137,6 +190,7 @@
|
|||||||
<DataTemplate>
|
<DataTemplate>
|
||||||
<TextBox Text="{Binding Unidade}"
|
<TextBox Text="{Binding Unidade}"
|
||||||
IsReadOnly="True"
|
IsReadOnly="True"
|
||||||
|
Foreground="#FF042271"
|
||||||
BorderThickness="0"
|
BorderThickness="0"
|
||||||
Background="Transparent"
|
Background="Transparent"
|
||||||
Padding="0"
|
Padding="0"
|
||||||
@ -153,6 +207,7 @@
|
|||||||
<DataTemplate>
|
<DataTemplate>
|
||||||
<TextBox Text="{Binding Codigo_Instalacao}"
|
<TextBox Text="{Binding Codigo_Instalacao}"
|
||||||
IsReadOnly="True"
|
IsReadOnly="True"
|
||||||
|
Foreground="#FF042271"
|
||||||
BorderThickness="0"
|
BorderThickness="0"
|
||||||
Background="Transparent"
|
Background="Transparent"
|
||||||
Padding="0"
|
Padding="0"
|
||||||
@ -169,6 +224,7 @@
|
|||||||
<DataTemplate>
|
<DataTemplate>
|
||||||
<TextBox Text="{Binding CNPJ_CPF}"
|
<TextBox Text="{Binding CNPJ_CPF}"
|
||||||
IsReadOnly="True"
|
IsReadOnly="True"
|
||||||
|
Foreground="#FF042271"
|
||||||
BorderThickness="0"
|
BorderThickness="0"
|
||||||
Background="Transparent"
|
Background="Transparent"
|
||||||
Padding="0"
|
Padding="0"
|
||||||
@ -185,6 +241,7 @@
|
|||||||
<DataTemplate>
|
<DataTemplate>
|
||||||
<TextBox Text="{Binding Razao_Social}"
|
<TextBox Text="{Binding Razao_Social}"
|
||||||
IsReadOnly="True"
|
IsReadOnly="True"
|
||||||
|
Foreground="#FF042271"
|
||||||
BorderThickness="0"
|
BorderThickness="0"
|
||||||
Background="Transparent"
|
Background="Transparent"
|
||||||
Padding="0"
|
Padding="0"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user