12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879 |
- 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.Navigation;
- using System.Windows.Shapes;
- namespace CollaborativePlatformProject.FormLibrary.CheckboxButton
- {
- /// <summary>
- /// CBButtonControls.xaml 的交互逻辑
- /// </summary>
- 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; }
- }
- }
|