Files
bluflame/aiwaz/Aiwaz.Editor/Controls/PropertyItem.xaml.cs
2026-04-18 22:31:51 +02:00

74 lines
2.6 KiB
C#

using System;
using System.Collections.Generic;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Input;
using System.ComponentModel;
namespace Aiwaz.Editor.Controls
{
/// <summary>
/// Interaction logic for PropertyItem.xaml
/// </summary>
public partial class PropertyItem : UserControl
{
public static readonly DependencyProperty PropertyNameProperty = DependencyProperty.Register("PropertyName", typeof(string), typeof(PropertyItem));
public static readonly DependencyProperty PropertyValueProperty = DependencyProperty.Register("PropertyValue", typeof(object), typeof(PropertyItem));
public static readonly DependencyProperty PropertyDescriptionProperty = DependencyProperty.Register("PropertyDescription", typeof(string), typeof(PropertyItem));
public static readonly DependencyProperty PropertyCategoryProperty = DependencyProperty.Register("PropertyCategory", typeof(string), typeof(PropertyItem));
public EventHandler<DescriptionEventArgs> DescriptionEventHandler;
public event EventHandler<DescriptionEventArgs> OnActive;
public PropertyItem()
{
InitializeComponent();
PropertyItemGrid.DataContext = this;
}
public string PropertyName {
get { return (string)GetValue(PropertyItem.PropertyNameProperty); }
set { SetValue(PropertyItem.PropertyNameProperty, value); }
}
public object PropertyValue
{
get{ return (string)GetValue(PropertyItem.PropertyValueProperty);}
set{ SetValue(PropertyItem.PropertyValueProperty, value); }
}
public string PropertyDescription
{
get { return (string)GetValue(PropertyItem.PropertyDescriptionProperty); }
set { SetValue(PropertyItem.PropertyDescriptionProperty, value);}
}
public string PropertyCategory
{
get { return (string)GetValue(PropertyItem.PropertyCategoryProperty); }
set { SetValue(PropertyItem.PropertyCategoryProperty, value); }
}
#region events
private void TextBox_MouseEnter(object sender, MouseEventArgs e)
{
if (OnActive != null) {
OnActive(this, new DescriptionEventArgs(PropertyDescription));
}
}
#endregion
}
public class DescriptionEventArgs : EventArgs{
public string Description { get; set;}
public DescriptionEventArgs(string descr){
this.Description = descr;
}
}
}