清空某行绑定的行数据:
1 int RowIndex = datagrid.SelectedIndex; 2 _Table.Rows[RowIndex]["AVERAGE_PRICE"] = DBNull.Value;
弹出层对象 :(用于弹出二级页面)
1 /// 弹出层对象 2 public static NavigationWindow window = null; 3 #region 使用NavigationWindow弹出页面 4 private void ShowNavigationWindow(string title, string uri, int width, int height) 5 { 6 try 7 { 8 window = new NavigationWindow();//创建窗体对象 9 window.Title = title; 10 window.MaxHeight = height; 11 window.MaxWidth = width; 12 window.Width = this.ActualWidth; 13 window.Height = this.ActualHeight; 14 window.WindowStyle = WindowStyle.ToolWindow;//设置边框样式 15 window.WindowStartupLocation = WindowStartupLocation.CenterScreen;//设置显示位置 16 window.ResizeMode = ResizeMode.NoResize;//设置显示 17 window.Source = new Uri(uri, UriKind.Relative);//设置url 18 window.ShowsNavigationUI = false; 19 window.ShowInTaskbar = false; 20 window.ShowDialog(); 21 window.Close(); 22 } 23 catch(Exception ex){ 24 25 } 26 27 }
将变量赋值给app中的全局变量
1 string backgoodsid = ""; string backgoodscode = ""; 2 DataGridRow row = sender as DataGridRow; 3 var cell = row.Item; 4 DataRowView item = cell as DataRowView; 5 if (item != null) 6 { 7 backgoodsid = item[0].ToString(); 8 } 9 if (item != null) 10 { 11 backgoodscode = item[4].ToString(); 12 } 13 string Startdate = STARTDATE.Text; 14 string Enddate = ENDDATE.Text; 15 string a = StaffSearchType.Text; 16 (Application.Current as App).BackgoodsCode = backgoodscode; 17 (Application.Current as App).Backgoodsid = backgoodsid; 18 (Application.Current as App).StartDate = Startdate; 19 (Application.Current as App).EndDate = Enddate; 20 (Application.Current as App).window = a;
在二级页面获取数据
1 #region 获取数据 2 3 if ((Application.Current as App).BackgoodsCode != "") 4 { 5 backgoodscode = (Application.Current as App).BackgoodsCode; 6 } 7 if((Application.Current as App).Backgoodsid != "") 8 { 9 backgoodsid= (Application.Current as App).Backgoodsid; 10 } 11 if ((Application.Current as App).Type != "") 12 { 13 type = (Application.Current as App).Type; 14 } 15 if ((Application.Current as App).StartDate != "") 16 { 17 Startdate = (Application.Current as App).StartDate; 18 } 19 if ((Application.Current as App).EndDate != "") 20 { 21 Enddate = (Application.Current as App).EndDate; 22 } 23 if ((Application.Current as App).window != "") 24 { 25 a = (Application.Current as App).window; 26 } 27 #endregion