using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; using System.Windows.Data; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Shapes; namespace CollaborativePlatformMain.Form.UserControlForm { /// /// CBButtonControls.xaml 的交互逻辑 /// public partial class CBButtonControls : UserControl { public CBButtonControlsData CbButtonControls; public CBButtonControls(CBButtonControlsData cbButtonControls) { InitializeComponent(); CbButtonControls = cbButtonControls; tb_name.Text = CbButtonControls.BtnName; cb_check.IsChecked = CbButtonControls.CbIsCheck; } private void UIElement_OnPreviewMouseLeftButtonUp(object sender, MouseButtonEventArgs e) { if ((bool)cb_check.IsChecked) { cb_check.IsChecked = false; } else { cb_check.IsChecked = true; } CbButtonControls.CbIsCheck = (bool)cb_check.IsChecked; } private void Cb_check_OnClick(object sender, RoutedEventArgs e) { if ((bool)cb_check.IsChecked) { cb_check.IsChecked = false; } else { cb_check.IsChecked = true; } CbButtonControls.CbIsCheck = (bool)cb_check.IsChecked; } } public class CBButtonControlsData { public CBButtonControlsData(string btnName, bool cbIsCheck, string imgPath) { BtnName = btnName; CbIsCheck = cbIsCheck; ImgPath = imgPath; Guid = System.Guid.NewGuid().ToString(); } public string Guid { get; set; } public string BtnName { get; set; } public bool CbIsCheck { get; set; } = false; public string ImgPath { get; set; } } }