using System; using System.Collections; using System.Windows; using System.Windows.Controls; using System.Windows.Input; namespace SWRIS.Controls { /// /// RecordControl.xaml 的交互逻辑 /// public partial class DamageRecordControl : UserControl { public DamageRecordControl() { InitializeComponent(); } public static readonly DependencyProperty RecordsProperty = DependencyProperty.Register("Records", typeof(IEnumerable), typeof(DamageRecordControl), new PropertyMetadata(null)); public static readonly DependencyProperty TitleProperty = DependencyProperty.Register("Title", typeof(string), typeof(DamageRecordControl), new PropertyMetadata("检测信息")); public IEnumerable Records { get => (IEnumerable)GetValue(RecordsProperty); set => SetValue(RecordsProperty, value); } public string Title { get => (string)GetValue(TitleProperty); set => SetValue(TitleProperty, value); } private void Record_MouseDown(object sender, MouseButtonEventArgs e) { if (e.ClickCount == 2) { if (sender is StackPanel panel && int.TryParse(panel.Tag?.ToString(), out int recordId)) { (Application.Current.MainWindow as MainWindow).NavigatePage(new Uri($"Pages/DamagesPage.xaml?id=" + recordId, uriKind: UriKind.Relative)); } } } } }