private void sortDataGrid()
        {
            string sort = "";

            for (int i = 0; i < lstSelectedColumns.Items.Count; i++)
            {
                ListItemForField item = (ListItemForField)lstSelectedColumns.Items[i];

                if (item.SortOrder == 0)
                {
                    if (sort == "")
                    {
                        sort = "[" + item.Field + "]" + " ASC ";
                    }
                    else
                    {
                        sort += ", [" + item.Field + "]" + " ASC ";
                    }
                }
                else
                {
                    if (sort == "")
                    {
                        sort = "[" + item.Field + "]" + " DESC ";
                    }
                    else
                    {
                        sort += ", [" + item.Field + "]" + " DESC ";
                    }
                }
            }

            dv.Sort = sort;
            dataGrid.ItemsSource = dv;
        }
        private void txtSearch_TextChanged(object sender, TextChangedEventArgs e)
        {
            List <ListItemForField> dizi = new List <ListItemForField>();

            for (int i = 0; i < lstFields.Items.Count; i++)
            {
                ListItemForField field = (ListItemForField)lstFields.Items[i];
                dizi.Add(field);
            }



            for (int i = 0; i < dizi.Count; i++)
            {
                bool deger = dizi[i].Field.Contains(txtSearch.Text);
                if (deger)
                {
                    dizi[i].ItemVisibility = true;
                }
                else
                {
                    dizi[i].ItemVisibility = false;
                }
            }


            lstFields.Items.Clear();

            for (int i = 0; i < dizi.Count; i++)
            {
                lstFields.Items.Add(dizi[i]);
            }
        }
        private void lstFields_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            ListBox lst = (ListBox)sender;

            if (lst.SelectedItem != null)
            {
                lstSelectedColumns.Items.Add(lst.SelectedItem);

                lstSelectedColumns.SelectedItem = lst.SelectedItem;

                ListItemForField item = (ListItemForField)lst.SelectedItem;

                lstFields.Items.Remove(lst.SelectedItem);

                btnDeleteSorting.IsEnabled = true;

                if (lstSelectedColumns.Items.Count > 1)
                {
                    btnMoveDown.IsEnabled = true;
                    btnMoveUp.IsEnabled   = true;
                }

                popup_Secim.IsOpen = false;

                sortDataGrid();
            }
        }