---
title: "checkbox"
author: "jcair"
date: "2015-07-28T17:18:49Z"
tags: []
categories: ["编程语言"]
slug: "checkbox"
draft: false
lastmod: "2015-07-28T17:18:49Z"
id: 2230936
url: "https://jcair.iteye.com/blog/2230936"
---

```C#

            private void CheckBox_Click(object sender, RoutedEventArgs e)
        {
            //lock (isSelectedIndexListLock)
            //{
            System.Windows.Controls.CheckBox dg = sender as System.Windows.Controls.CheckBox;
            int iIndex = dataGridReserveCommisList.SelectedIndex;
            OrderFModel orderFModel = dataGridReserveCommisList.SelectedItem as OrderFModel;
            if (orderFModel == null)
            {
                return;

            }
            string orderLocalId = orderFModel.OrderLocalID;
            var bl = dg.IsChecked;
            if (bl == true)
            {
                /*
                 * #add IsSelectedIndexList add
                 */
                IsSelectedOrderLocalIdList.Add(orderLocalId);
            }
            else
            {
                /*
                * #add IsSelectedIndexList remove
                */
                IsSelectedOrderLocalIdList.Remove(orderLocalId);  //如果选中取消就删除里面的FID
            }
            //}
        }

```