日期:2014-05-20 浏览次数:21008 次
<DataGridTemplateColumn Header="数量"> <DataGridTemplateColumn.CellEditingTemplate> <DataTemplate> <TextBlock Text="{Binding Count}" /> </DataTemplate> </DataGridTemplateColumn.CellEditingTemplate> <DataGridTemplateColumn.CellTemplate> <DataTemplate> <StackPanel> <TextBox Text="{Binding Count}" ></TextBox> <Button Content="+"></Button> <Button Content="-"></Button> </StackPanel> </DataTemplate> </DataGridTemplateColumn.CellTemplate> </DataGridTemplateColumn>
/// <summary> /// 绑定数据到数据显示表格 /// </summary> private void DataGridProductBind() { List<Model.Product> list; if (Variable.ProductBindType.ToLower() == "all") { list = Variable.Products; } else if (Variable.ProductBindType.ToLower() == "selected") { list = Variable.Products.Where(n => n.Count > 0 || n.IsExport).ToList(); } else { list = Variable.Products.Where(n => n.ProductCategoryID.Equals(ConvertHelper.ObjectToGuid(Variable.ProductBindType, Guid.Empty))).ToList(); } DemandBind(); this.dgProduct.ItemsSource = null; this.dgProduct.ItemsSource = list; }