Home > Net >  A WPF custom control to obtain values but cannot be transferred to the viewmodel, hope leaders help
A WPF custom control to obtain values but cannot be transferred to the viewmodel, hope leaders help

Time:02-03

Custom controls the background


 public static readonly DependencyProperty SelectItemProperty=DependencyProperty. Register (" SelectGridItem typeof (OutboundOrder), typeof (Salesdatagrid)); 
Public OutboundOrder SelectGridItem
{
The get
{
Return (OutboundOrder) enclosing GetValue (SelectItemProperty);
}
Set
{
Enclosing SetValue (SelectItemProperty, value);
}
}




Private void Grid_OnSelectedCellsChanged (object sender, SelectedCellsChangedEventArgs e)
{
SelectGridItem=Grid. SelectedItem as OutboundOrder;
}


Mainwindow calls
 & lt; Border Grid. The Column="0" & gt; 


Now is SelectGridItem has value, the viewmodel unable to get to the value
 private OutboundOrder _selectSaleItem; 

Public OutboundOrder SelectSaleItem
{
The get {return _selectSaleItem; }
Set
{
_selectSaleItem=value;
RaisePropertyChanged (()=& gt; SelectSaleItem);
}
}

Is this what to make of it, or I where binding wrong

  •  Tags:  
  • C#
  • Related