or
| private void OnChildGridLoaded(object sender, RoutedEventArgs e) |
| { |
| try |
| { |
| if (((ComboBoxValues.ComboValues)cmbActivityType.SelectedValue).Id != 0) |
| { |
| dsAcoount.Tables["Budget"].DefaultView.RowFilter = "ActivityTypeID=" + ((ComboBoxValues.ComboValues)cmbActivityType.SelectedValue).Id; |
| ((RadGridView)sender).ItemsSource = null; |
| ((RadGridView)sender).ItemsSource = dsAcoount.Tables["Budget"].DefaultView; |
| } |
| } |
if (el.VisualHit != null && (el.VisualHit as UIElement).IsHitTestVisible)
System.Windows.Media.DrawingVisual doesn't inherit from UIElement, so the as returns null and we get an exception.

| private void BindDataMainGrid() |
| { |
| try |
| { |
| thisthis.gvAccount.ItemsSource = this.GetData(); |
| } |
| catch{} |
| } |
| private DataSet GetData() |
| { |
| try |
| { |
| dsb = ServiceData.GetBudgetsByOBS(iOBSID); |
| if (dsb != null) |
| { |
| dsb.Tables["Budget"].Columns.Add("SumBudgetAllocation", typeof(float)); |
| dsb.Tables["Budget"].Columns.Add("SumBudgetRequest", typeof(float)); |
| dsb.Tables["Budget"].Columns.Add("SumOrderAllocation", typeof(float)); |
| dsb.Tables["Budget"].Columns.Add("SumOrderPaid", typeof(float)); |
| foreach (DataRow dr in dsb.Tables["Budget"].Rows) |
| { |
| dr["RowStatus"] = 0; |
| if (dsb.Tables["BudgetAllocation"].Select("id=" + Convert.ToInt32(dr["ID"])).GetLength(0) > 0) |
| { |
| dr["SumBudgetAllocation"] = Convert.ToDecimal(((LM_Model.dsBudget.BudgetAllocationRow)dsb.Tables["BudgetAllocation"].Select("id=" + Convert.ToInt32(dr["ID"]))[0]).ItemArray[1]); |
| } |
| if (dsb.Tables["BudgetRequest"].Select("BudgetId=" + Convert.ToInt32(dr["ID"])).GetLength(0) > 0) |
| { |
| dr["SumBudgetRequest"] = Convert.ToDecimal(((LM_Model.dsBudget.BudgetRequestRow)dsb.Tables["BudgetRequest"].Select("BudgetId=" + Convert.ToInt32(dr["ID"]))[0]).ItemArray[1]); |
| } |
| if (dsb.Tables["BudgetOrder"].Select("BudgetId=" + Convert.ToInt32(dr["ID"])).GetLength(0) > 0) |
| { |
| dr["SumOrderAllocation"] = Convert.ToDecimal(((LM_Model.dsBudget.BudgetOrderRow)dsb.Tables["BudgetOrder"].Select("BudgetId=" + Convert.ToInt32(dr["ID"]))[0]).ItemArray[1]); |
| } |
| if (dsb.Tables["BudgetOrderPaid"].Select("Id=" + Convert.ToInt32(dr["ID"])).GetLength(0) > 0) |
| { |
| dr["SumOrderPaid"] = Convert.ToDecimal(((LM_Model.dsBudget.BudgetOrderPaidRow)dsb.Tables["BudgetOrderPaid"].Select("Id=" + Convert.ToInt32(dr["ID"]))[0]).ItemArray[1]); |
| } |
| } |
| dsb.Tables["Budget"].Columns.Add("BalanceBudgetAllocation", typeof(float), "TotalBudget-SumBudgetAllocation"); |
| dsb.Tables["Budget"].Columns.Add("BalanceToPay", typeof(float), "SumBudgetRequest-SumOrderPaid"); |
| //Build dsAcoount |
| dsAcoount = new DataSet(); |
| DataView dv = new DataView(dsb.Tables["Budget"], "Type=1", "", DataViewRowState.CurrentRows); |
| dsAcoount.Tables.Add((DataTable)dv.ToTable("Account")); |
| dv = new DataView(dsb.Tables["Budget"], "Type=2", "", DataViewRowState.CurrentRows); |
| dsAcoount.Tables.Add((DataTable)dv.ToTable("Budget")); |
| dv = new DataView(dsb.Tables["Budget"], "Type=3", "", DataViewRowState.CurrentRows); |
| dsAcoount.Tables.Add((DataTable)dv.ToTable("SubBudget")); |
| LM_Model.clsEnums.BudgetType eVal = clsEnums.BudgetType.Investment; |
| decimal dCurrentInvestment = Convert.ToDecimal(dsAcoount.Tables["Account"].Compute("SUM(TotalBudget)", "BudgetType=" + Convert.ToInt32(eVal))); |
| txtbInvestmentSum.Text = dCurrentInvestment.ToString("#,##0.00"); |
| eVal = clsEnums.BudgetType.Continuous; |
| decimal dCurrentContinues = Convert.ToDecimal(dsAcoount.Tables["Account"].Compute("SUM(TotalBudget)", "BudgetType=" + Convert.ToInt32(eVal))); |
| txtbContinuesSum.Text = dCurrentContinues.ToString("#,##0.00"); |
| decimal dInvestmentBaseline = Convert.ToDecimal(dsb.Tables["BaselineBudget"].Rows[0]["InvestmentBaseline"]); |
| decimal dContinuesBaseline = Convert.ToDecimal(dsb.Tables["BaselineBudget"].Rows[0]["ContinuesBaseline"]); |
| decimal dI = (dCurrentInvestment / dInvestmentBaseline - 1) * 100; |
| decimal dC = (dCurrentContinues / dContinuesBaseline - 1) * 100; |
| txtInv.Text = dI.ToString("#.00"); |
| txtCon.Text = dC.ToString("#.00"); |
| DateTime dDate = (DateTime)dsb.Tables["BaselineBudget"].Rows[0]["Date"]; |
| txtBLDate.Text = dDate.ToString("dd/MM/yyyy"); |
| //Add Relations |
| dsAcoount.Relations.Add("BudgetRelation", |
| dsAcoount.Tables["Account"].Columns["Number"], |
| dsAcoount.Tables["Budget"].Columns["ParentID"]); |
| dsAcoount.Relations.Add("SubBudgetRelation", |
| dsAcoount.Tables["Budget"].Columns["Number"], |
| dsAcoount.Tables["SubBudget"].Columns["ParentID"]); |
| return dsAcoount; |
| } |
| } |
| catch { } |
| return null; |
| } |
| ((GridViewComboBoxColumn)((RadGridView)sender).Columns["ActivityTypeID"]).ItemsSource = ComboBoxValues.GetComboValues(dtActivityType.Select("ID < 2000")); |

We are using the Radtreeview control in our Query Builder application to show the Tables and Fields from the Dtabase . The user can drag and drop the fields in to Selection list (select clause - listbox) and Condition list (where clause - listbox). When i drag and drop the field in to Selection list or Condition list, the selected treeview item(field) removed from the RadTreeView. I want to use the same field in both the lists.
Thanks,