using Aitex.Core.RT.IOCore; using MECF.Framework.Common.IOCore; 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 MECF.Framework.UI.Core.Control { /// /// DIItemEditor.xaml 的交互逻辑 /// public partial class AoItemEditor : UserControl { public AoItemEditor() { InitializeComponent(); } private void Button_Click(object sender, RoutedEventArgs e) { // (dataGrid.SelectedItem as NotifiableIoItem).ShortValue = 10; //(dataGrid.Columns[3].GetCellContent(dataGrid.SelectedItem) as TextBlock).Text = "20"; var selectedItem = dataGrid.SelectedItem; DataGridTemplateColumn templeColumn = dataGrid.Columns[4] as DataGridTemplateColumn; FrameworkElement s = dataGrid.Columns[4].GetCellContent(selectedItem); TextBox tbOper = templeColumn.CellTemplate.FindName("tb1", s) as TextBox; AOAccessor t; if ((selectedItem as NotifiableIoItem).Name.Contains("PMA")) { t = IO.GetAoList("PMA.PLC").Where(x => x.Index == (selectedItem as NotifiableIoItem).Index).FirstOrDefault(); } else { t = IO.GetAoList("PMB.PLC").Where(x => x.Index == (selectedItem as NotifiableIoItem).Index).FirstOrDefault(); } t.Value = Convert.ToInt16(tbOper.Text); } } }