Falta terminar el highlight
This commit is contained in:
parent
d4ca7e3aa7
commit
dd2b656c69
|
@ -171,7 +171,21 @@ namespace CtrEditor
|
||||||
OnPropertyChanged(nameof(SelectedImage));
|
OnPropertyChanged(nameof(SelectedImage));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private osBase _selectedItemOsList;
|
||||||
|
public osBase SelectedItemOsList
|
||||||
|
{
|
||||||
|
get => _selectedItemOsList;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (_selectedItemOsList != value)
|
||||||
|
{
|
||||||
|
_selectedItemOsList = value;
|
||||||
|
OnPropertyChanged(nameof(SelectedItemOsList));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public ICommand OpenWorkDirectoryCommand { get; }
|
public ICommand OpenWorkDirectoryCommand { get; }
|
||||||
|
|
||||||
private void OpenWorkDirectory()
|
private void OpenWorkDirectory()
|
||||||
|
|
|
@ -72,7 +72,9 @@
|
||||||
<ListBox x:Name="ListaOs"
|
<ListBox x:Name="ListaOs"
|
||||||
Grid.Row="0"
|
Grid.Row="0"
|
||||||
Margin="5"
|
Margin="5"
|
||||||
ItemsSource="{Binding ObjetosSimulables}" DisplayMemberPath="Nombre" SelectionChanged="ListaOs_SelectionChanged"/>
|
ItemsSource="{Binding ObjetosSimulables}" DisplayMemberPath="Nombre"
|
||||||
|
SelectedItem="{Binding SelectedItemOsList, Mode=TwoWay}"
|
||||||
|
SelectionChanged="ListaOs_SelectionChanged"/>
|
||||||
<StackPanel x:Name="PanelEdicion" Grid.Row="1" Margin="5">
|
<StackPanel x:Name="PanelEdicion" Grid.Row="1" Margin="5">
|
||||||
<!-- Aquí puedes agregar los controles para editar propiedades -->
|
<!-- Aquí puedes agregar los controles para editar propiedades -->
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
|
|
@ -3,6 +3,7 @@ using System.Windows;
|
||||||
using System.Windows.Controls;
|
using System.Windows.Controls;
|
||||||
using System.Windows.Data;
|
using System.Windows.Data;
|
||||||
using System.Windows.Documents;
|
using System.Windows.Documents;
|
||||||
|
using System.Windows.Forms;
|
||||||
using System.Windows.Input;
|
using System.Windows.Input;
|
||||||
using System.Windows.Media;
|
using System.Windows.Media;
|
||||||
using System.Windows.Media.Imaging;
|
using System.Windows.Media.Imaging;
|
||||||
|
@ -10,6 +11,11 @@ using System.Windows.Navigation;
|
||||||
using System.Windows.Shapes;
|
using System.Windows.Shapes;
|
||||||
using CtrEditor.ObjetosSim;
|
using CtrEditor.ObjetosSim;
|
||||||
using static System.Runtime.InteropServices.JavaScript.JSType;
|
using static System.Runtime.InteropServices.JavaScript.JSType;
|
||||||
|
using Binding = System.Windows.Data.Binding;
|
||||||
|
using Label = System.Windows.Controls.Label;
|
||||||
|
using MouseEventArgs = System.Windows.Input.MouseEventArgs;
|
||||||
|
using TextBox = System.Windows.Controls.TextBox;
|
||||||
|
using UserControl = System.Windows.Controls.UserControl;
|
||||||
|
|
||||||
namespace CtrEditor
|
namespace CtrEditor
|
||||||
{
|
{
|
||||||
|
@ -116,6 +122,15 @@ namespace CtrEditor
|
||||||
userControl.CaptureMouse(); // Importante para recibir eventos de movimiento incluso fuera del control
|
userControl.CaptureMouse(); // Importante para recibir eventos de movimiento incluso fuera del control
|
||||||
_isMovingUserControl = true;
|
_isMovingUserControl = true;
|
||||||
|
|
||||||
|
if (sender is UserControl control && control.DataContext is osBase datos)
|
||||||
|
{
|
||||||
|
var viewModel = DataContext as MainViewModel;
|
||||||
|
if (viewModel != null)
|
||||||
|
{
|
||||||
|
viewModel.SelectedItemOsList = datos; // Esto desencadenará ListaOs_SelectionChanged
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// ROTACION
|
// ROTACION
|
||||||
if (Keyboard.IsKeyDown(Key.LeftShift))
|
if (Keyboard.IsKeyDown(Key.LeftShift))
|
||||||
{
|
{
|
||||||
|
@ -258,26 +273,18 @@ namespace CtrEditor
|
||||||
_startPointUserControl = currentPosition;
|
_startPointUserControl = currentPosition;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private void UserControl_MouseEnter(object sender, MouseEventArgs e)
|
private void UserControl_MouseEnter(object sender, MouseEventArgs e)
|
||||||
{
|
{
|
||||||
// Lógica a ejecutar cuando el mouse entra en el UserControl
|
|
||||||
if (sender is UserControl userControl)
|
if (sender is UserControl userControl)
|
||||||
{
|
if (userControl is IDataContainer dataContainer)
|
||||||
// Por ejemplo, cambiar el color de fondo para indicar el foco
|
dataContainer.Highlight(true);
|
||||||
userControl.Background = Brushes.LightBlue;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void UserControl_MouseLeave(object sender, MouseEventArgs e)
|
private void UserControl_MouseLeave(object sender, MouseEventArgs e)
|
||||||
{
|
{
|
||||||
// Lógica a ejecutar cuando el mouse sale del UserControl
|
|
||||||
if (sender is UserControl userControl)
|
if (sender is UserControl userControl)
|
||||||
{
|
if (userControl is IDataContainer dataContainer)
|
||||||
// Restaurar el color de fondo original
|
dataContainer.Highlight(false);
|
||||||
userControl.Background = Brushes.White;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ViewModel_ImageSelected(object sender, string imagePath)
|
private void ViewModel_ImageSelected(object sender, string imagePath)
|
||||||
|
|
|
@ -23,6 +23,7 @@ namespace CtrEditor.ObjetosSim
|
||||||
void Resize(double width, double height);
|
void Resize(double width, double height);
|
||||||
void Move(double Left, double Top);
|
void Move(double Left, double Top);
|
||||||
void Rotate(double Angle);
|
void Rotate(double Angle);
|
||||||
|
void Highlight(bool State);
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract class osBase : INotifyPropertyChanged, IosBase
|
public abstract class osBase : INotifyPropertyChanged, IosBase
|
||||||
|
|
|
@ -2,5 +2,5 @@
|
||||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
DataContext="{Binding RelativeSource={RelativeSource Self}}">
|
DataContext="{Binding RelativeSource={RelativeSource Self}}">
|
||||||
<Border Background="Brown" CornerRadius="10" Height="10" Width="10"/>
|
<Border Background="Brown" CornerRadius="10" Height="10" Width="10"/>
|
||||||
</UserControl>
|
</UserControl>
|
|
@ -50,6 +50,7 @@ namespace CtrEditor.ObjetosSim
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public void Rotate(double Angle) { }
|
public void Rotate(double Angle) { }
|
||||||
|
public void Highlight(bool State) { }
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,12 +5,13 @@
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:local="clr-namespace:CtrEditor"
|
xmlns:local="clr-namespace:CtrEditor"
|
||||||
mc:Ignorable="d">
|
mc:Ignorable="d">
|
||||||
<Canvas>
|
<Canvas>
|
||||||
<Rectangle Width="{Binding Ancho}" Height="{Binding Alto}" Fill="Gray">
|
<Rectangle Width="{Binding Ancho}" Height="{Binding Alto}" Fill="Gray">
|
||||||
<Rectangle.RenderTransform>
|
<Rectangle.RenderTransform>
|
||||||
<RotateTransform Angle="{Binding Angulo}"/>
|
<RotateTransform Angle="{Binding Angulo}"/>
|
||||||
</Rectangle.RenderTransform>
|
</Rectangle.RenderTransform>
|
||||||
</Rectangle>
|
</Rectangle>
|
||||||
</Canvas>
|
</Canvas>
|
||||||
|
|
||||||
</UserControl>
|
</UserControl>
|
||||||
|
|
||||||
|
|
|
@ -94,6 +94,7 @@ namespace CtrEditor.ObjetosSim
|
||||||
if (Datos is osTransporteTTop datos)
|
if (Datos is osTransporteTTop datos)
|
||||||
datos.Angulo = Angle;
|
datos.Angulo = Angle;
|
||||||
}
|
}
|
||||||
|
public void Highlight(bool State) { }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue