コード例 #1
0
        /// <summary>
        /// 附件列表删除
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btn_delete_Click(object sender, RoutedEventArgs e)
        {
            MessageBoxResult result = MessageBox.Show("确认要删除选中项?", "提示", MessageBoxButton.YesNo);

            if (result == MessageBoxResult.Yes)
            {
                if (AttachmentSources != null || AttachmentSources.Count > 0)
                {
                    List <FileAttachment> delatt = AttachmentSources.Where(p => p.IsChecked == true).ToList();
                    foreach (FileAttachment att in delatt)
                    {
                        att.DataState = DataStateEnum.Deleted;
                    }
                    UpdateAttSource();
                    chkAll.IsChecked = false;
                }

                if (AttachmentSources == null || AttachmentSources.Count == 0)
                {
                    xpsDocViewr.Document = null;
                }
            }
        }
コード例 #2
0
 /// <summary>
 /// 更新附件数据源
 /// </summary>
 private void UpdateAttSource()
 {
     CurrentFile.Attachments = new List <FileAttachment>(AttachmentSources);
     dgList.ItemsSource      = AttachmentSources.Where(r => r.DataState != DataStateEnum.Deleted);
 }