Files
SamplePreSystem-CS/SamplePreSystem.UI/Views/ConfigManager/chirld/NewUserWindow.xaml.cs

57 lines
1.4 KiB
C#
Raw Normal View History

2026-04-30 11:34:41 +08:00
using SamplePre.UIWpf.BaseWindows;
using SamplePreSystem.UI.BaseControls;
using SamplePreSystem.UI.ViewModel.ConfigManager;
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 SamplePre.UIWpf.ConfigManager.chirld
{
/// <summary>
/// NewUserWindow.xaml 的交互逻辑
/// </summary>
public partial class NewUserWindow : BaseWindow
{
public NewUserWindow(UsersViewModel vm)
{
InitializeComponent();
vm.CloseAction = (val) => DialogResult = val;
this.DataContext = vm;
}
private void ckbRole_Click(object sender, RoutedEventArgs e)
{
e.Handled = true;
UpdateSelectedText();
}
// 把选中的项显示在文本框中
private void UpdateSelectedText()
{
var selected = cmbRole.ItemsSource.Cast<dynamic>()
.Where(x => x.IsSelected == true)
.Select(x => x.name);
txtSelectedRoles.Text = string.Join("", selected);
}
private void btnCancel_Click(object sender, RoutedEventArgs e)
{
UpdateSelectedText();
}
}
}