<dsgc:DataSetListEntityControl x:Class="BMITQT.Quotation.QuotationComponentList"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:igDP="http://infragistics.com/DataPresenter"
xmlns:sys="clr-namespace:System;assembly=mscorlib"
xmlns:mgw="clr-namespace:Mg2.Windows;assembly=Mg2.Windows"
xmlns:dsgc="clr-namespace:BMITQT.BuziLogic;assembly=BMITQT.BuziLogic"
xmlns:mgc="clr-namespace:Mg2.Windows.Controls;assembly=Mg2.Windows"
xmlns:mig="clr-namespace:Mg2.Ig.Windows;assembly=Mg2.Ig.Windows"
xmlns:igEditors="http://infragistics.com/Editors"
<Grid.RowDefinitions>
<RowDefinition Height="20" ></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="30"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
</Grid.ColumnDefinitions>
<TextBlock Grid.Row="0" Grid.Column="0" Height="20" Background="White"></TextBlock>
<TextBlock Name="txtCaption" Grid.Column="1" Text=" Quotation Component" Grid.Row="0" Background="White"></TextBlock>
<mig:MigDataGrid Grid.Row="1" Grid.ColumnSpan="2" x:Name="grdQuotationComponent" Theme="Office2k7Black" MouseDoubleClick="grdQuotationComponent_MouseDoubleClick" InitializeRecord="grdQuotationComponent_InitializeRecord" CellUpdated="grdQuotationComponent_CellUpdated" CellActivating="grdQuotationComponent_CellActivating" GroupByAreaLocation="None">
<igDP:XamDataGrid.Resources>
<!-- This items provider is populated in the code-behind. -->
<igEditors:ComboBoxItemsProvider x:Key="StatusItemsProvider" />
<Style x:Key="StatusFieldStyle" TargetType="{x:Type igEditors:XamComboEditor}">
<Setter Property="ItemsProvider" Value="{StaticResource StatusItemsProvider}" />
</Style>
</igDP:XamDataGrid.Resources>
<igDP:XamDataGrid.FieldLayouts>
<igDP:FieldLayout >
<igDP:FieldLayout.Fields>
<igDP:Field Name="QuotationComponentId" Label="{StaticResource BMITQT.Quotation.QuotationComponentList.lblQuotationComponentId}" Visibility="Collapsed">
<igDP:Field.Settings>
<igDP:FieldSettings AllowEdit="False" CellWidth="0"/>
</igDP:Field.Settings>
</igDP:Field>
<igDP:Field Name="ComponentCode" Label="{StaticResource BMITQT.Quotation.QuotationComponentList.lblComponentCode}">
<igDP:Field.Settings>
<igDP:FieldSettings AllowEdit="False" CellWidth="50" CellClickAction="SelectRecord"/>
</igDP:Field.Settings>
</igDP:Field>
<igDP:Field Name="ComponentTypeName" Label="{StaticResource BMITQT.Quotation.QuotationComponentList.lblComponentTypeName}">
<igDP:Field.Settings>
<igDP:FieldSettings AllowEdit="False" CellWidth="50" CellClickAction="SelectRecord"/>
</igDP:Field.Settings>
</igDP:Field>
<igDP:Field Name="StatisticsTypeName" Label="{StaticResource BMITQT.Quotation.QuotationComponentList.lblStatisticsTypeName}">
<igDP:Field.Settings>
<igDP:FieldSettings AllowEdit="False" CellWidth="50" CellClickAction="SelectRecord"/>
</igDP:Field.Settings>
</igDP:Field>
<igDP:Field Name="ComponentUnitName" Label="{StaticResource BMITQT.Quotation.QuotationComponentList.lblUnit}">
<igDP:Field.Settings>
<igDP:FieldSettings AllowEdit="False" CellWidth="50" CellClickAction="SelectRecord"/>
</igDP:Field.Settings>
</igDP:Field>
<igDP:Field Name="ManufacturerName" Label="{StaticResource BMITQT.Quotation.QuotationComponentList.lblManufacturer}">
<igDP:Field.Settings>
<igDP:FieldSettings AllowEdit="False" CellWidth="50" CellClickAction="SelectRecord"/>
</igDP:Field.Settings>
</igDP:Field>
<igDP:Field Name="Specification" Label="{StaticResource BMITQT.Quotation.QuotationComponentList.lblSpecification}">
<igDP:Field.Settings>
<igDP:FieldSettings AllowEdit="False" CellWidth="50" CellClickAction="SelectRecord"/>
</igDP:Field.Settings>
</igDP:Field>
<igDP:Field Name="Price" Label="{StaticResource BMITQT.Module.ModuleComponent_ComponentCostList.Price}">
<igDP:Field.Settings>
<igDP:FieldSettings EditorStyle="{StaticResource StatusFieldStyle}" CellWidth="100" LabelWidth="100" CellValuePresenterStyle="{StaticResource EditCellStyle}" />
</igDP:Field.Settings>
</igDP:Field>
<igDP:Field Name="Quantity" Label="{StaticResource BMITQT.Quotation.QuotationComponentList.lblQuantity}">
<igDP:Field.Settings>
<igDP:FieldSettings AllowEdit="True" EditAsType="{x:Type sys:Int32}" CellWidth="100" CellClickAction="EnterEditModeIfAllowed" CellValuePresenterStyle="{StaticResource EditCellStyle}" />
</igDP:Field.Settings>
</igDP:Field>
<igDP:Field Name="Description" Label="{StaticResource BMITQT.Quotation.QuotationComponentList.lblDescription}">
<igDP:Field.Settings>
<igDP:FieldSettings AllowEdit="False" CellWidth="50" CellClickAction="SelectRecord"/>
</igDP:Field.Settings>
</igDP:Field>
</igDP:FieldLayout.Fields>
</igDP:FieldLayout>
</igDP:XamDataGrid.FieldLayouts>
<igDP:XamDataGrid.ContextMenu>
<ContextMenu Width="150" Background="WhiteSmoke" Margin="15">
<MenuItem Name="menuAdd" Margin="3" Click="menuAdd_Click" Header="{StaticResource UI.Common.ListWindow.Menu.Add}">
<MenuItem.Icon>
<Image Source="/Icons/PopUpAdd.GIF"></Image>
</MenuItem.Icon>
</MenuItem>
<MenuItem Name="menuModify" Margin="3" Click="menuModify_Click" Header="{StaticResource UI.Common.ListWindow.Menu.Modify}">
<MenuItem.Icon>
<Image Source="/Icons/PopUpModify.GIF"></Image>
</MenuItem.Icon>
</MenuItem>
<MenuItem Name="menuDelete" Margin="3" Click="menuDelete_Click" Header="{StaticResource UI.Common.ListWindow.Menu.Delete}">
<MenuItem.Icon>
<Image Source="/Icons/PopUpDelete.GIF"></Image>
</MenuItem.Icon>
</MenuItem>
<MenuItem Name="menuComponentCost" Margin="3" Click="menuComponentCost_Click" Header="{StaticResource UI.Common.QuotationComponentList.Menu.QuotationComponentCost}">
<MenuItem.Icon>
<Image Source="/Icons/PopUpAdd.GIF"></Image>
</MenuItem.Icon>
</MenuItem>
<MenuItem Name="menuComponentPrice" Margin="3" Click="menuComponentPrice_Click" Header="{StaticResource UI.Common.QuotationComponentList.Menu.QuotationComponentPrice}">
<MenuItem.Icon>
<Image Source="/Icons/PopUpAdd.GIF"></Image>
</MenuItem.Icon>
</MenuItem>
</ContextMenu>
</igDP:XamDataGrid.ContextMenu>
</mig:MigDataGrid>
</Grid>
</dsgc:DataSetListEntityControl>
private DataTable _categoryCostSummaryDt = new DataTable(); //Store parent quoation category summary cost
public long? QuotationCategoryId { get; set; }
public QuotationComponentList()
InitializeComponent();
_entityType = typeof(BMITQT.Po.QuotationComponent);
_dataSource = new DataTable();
//Load Grid Data
public void LoadGridData()
AddSummaryFields();
DataSet ds = new DataSet();
DataTable dtQuotationComponent = GetQuotationComponent(); //Get parent datatable
DataTable dtCost = GetQuotationComponentCost(dtQuotationComponent); //Get child datatable
ds.Tables.Add(dtQuotationComponent);
ds.Tables.Add(dtCost);
//Create relation between parent datatable and child datatable
ds.Relations.Add(new DataRelation("QuotationComponentQutationComponentCost", dtQuotationComponent.Columns["QuotationComponentId"], ds.Tables[1].Columns["QuotationComponentId"]));
this.grdQuotationComponent.DataSource = dtQuotationComponent.DefaultView;
//Get Quotation Component DataTable (Parent DataTable)
protected DataTable GetQuotationComponent()
string rowFilerString = "";
DataTable dtQuotationComponent = new DataTable();
dtQuotationComponent.Columns.Add("QuotationComponentId", typeof(Int64));
dtQuotationComponent.Columns.Add("ComponentCode", typeof(string));
dtQuotationComponent.Columns.Add("Description", typeof(string));
dtQuotationComponent.Columns.Add("Price", typeof(float));
dtQuotationComponent.Columns.Add("Quantity", typeof(float));
dtQuotationComponent.Columns.Add("Specification", typeof(string));
dtQuotationComponent.Columns.Add("ManufacturerName");
dtQuotationComponent.Columns.Add("ComponentTypeName");
dtQuotationComponent.Columns.Add("ComponentUnitName");
dtQuotationComponent.Columns.Add("StatisticsTypeName");
dtQuotationComponent.Columns.Add("Material Cost SubTotal");
dtQuotationComponent.Columns.Add("Subtotal");
foreach (DataRowView quotationComponentDr in this.QuotationDataSet.QuotationComponent.DefaultView)
DataRow newRow = dtQuotationComponent.NewRow();
newRow["QuotationComponentId"] = quotationComponentDr["QuotationComponentId"];
newRow["ComponentCode"] = quotationComponentDr["ComponentCode"];
newRow["Description"] = quotationComponentDr["Description"];
newRow["Quantity"] = quotationComponentDr["Quantity"];
newRow["Specification"] = quotationComponentDr["Specification"];
newRow["ManufacturerName"] = this.QuotationDataSet.Manufacturer.FindByManufacturerId((long)quotationComponentDr["ManufacturerId"]).ManufacturerName;
if (quotationComponentDr["ComponentTypeId"] != DBNull.Value)
newRow["ComponentTypeName"] = this.QuotationDataSet.ComponentType.FindByComponentTypeId((long)quotationComponentDr["ComponentTypeId"]).ComponentTypeName;
newRow["ComponentTypeName"] = "";
if (quotationComponentDr["ComponentUnitId"] != DBNull.Value)
newRow["ComponentUnitName"] = this.QuotationDataSet.ComponentUnit.FindByComponentUnitId((long)quotationComponentDr["ComponentUnitId"]).ComponentUnitName;
newRow["ComponentUnitName"] = "";
newRow["StatisticsTypeName"] = this.QuotationDataSet.StatisticsType.FindByStatisticsTypeId((long)quotationComponentDr["StatisticsTypeId"]).StatisticsTypeName;
if (quotationComponentDr["QuotationComponentPriceId"] != DBNull.Value)
newRow["Price"] = this.QuotationDataSet.QuotationComponentPrice.FindByQuotationComponentPriceId((long)quotationComponentDr["QuotationComponentPriceId"]).Price;
//else
// newRow["Price"] = "";
long quotationComponentId = long.Parse(quotationComponentDr["QuotationComponentId"].ToString());
newRow["Material Cost SubTotal"] = DataSetCalculateUtil.GetQuotationComponentMaterialCostSubtotal(quotationComponentId, this.QuotationController);
newRow["SubTotal"] = DataSetCalculateUtil.GetQuotationComponentSubtotal(quotationComponentId, this.QuotationController);
dtQuotationComponent.Rows.Add(newRow);
return dtQuotationComponent;
//Get Quotation Component Cost DataTable (Child DataTable)
protected DataTable GetQuotationComponentCost(DataTable dtQuotationComponent)
List<string> quotationComponentIds = new List<string>();
foreach (DataRow dr in dtQuotationComponent.Rows)
quotationComponentIds.Add(dr["QuotationComponentId"].ToString());
string[] Ids = quotationComponentIds.ToArray();
DataTable dtCost = new DataTable();
dtCost.Columns.Add("QuotationComponentCostId", typeof(Int64));
dtCost.Columns.Add("QuotationComponentId", typeof(Int64));
dtCost.Columns.Add("Unit", typeof(string));
dtCost.Columns.Add("Currency", typeof(string));
dtCost.Columns.Add("Calculate Method", typeof(string));
dtCost.Columns.Add("Quantity", typeof(float));
dtCost.Columns.Add("Rate", typeof(float));
dtCost.Columns.Add("Amount", typeof(float));
dtCost.Columns.Add("Unit SubTotal", typeof(string));
dtCost.Columns.Add("SubTotal", typeof(string));
//If there are parent quotation component, get quotation component cost in these quotation components
if (Ids.Length > 0)
string rowFilterString = "QuotationComponentId in (" + string.Join(",", Ids) + ")";
QuotationDataSet.QuotationComponentCost.DefaultView.RowFilter = rowFilterString;
foreach (DataRowView dr in QuotationDataSet.QuotationComponentCost.DefaultView)
DataRow newRow = dtCost.NewRow();
newRow["QuotationComponentCostId"] = dr["QuotationComponentCostId"];
newRow["QuotationComponentId"] = dr["QuotationComponentId"];
if (dr["CostUnitId"] != DBNull.Value)
newRow["Unit"] = this.QuotationDataSet.CostUnit.FindByCostUnitId((long)dr["CostUnitId"]).CostUnitName;
newRow["Unit"] = "";
if (dr["CurrencyId"] != DBNull.Value)
newRow["Currency"] = this.QuotationDataSet.Currency.FindByCurrencyId((long)dr["CurrencyId"]).CurrencyCode;
newRow["Currency"] = "";
if (dr["CostCalculateMethodId"] != DBNull.Value)
newRow["Calculate Method"] = this.QuotationDataSet.CostCalculateMethod.FindByCostCalculateMethodId((long)dr["CostCalculateMethodId"]).CostCalculateMethodName;
newRow["Calculate Method"] = "";
newRow["Quantity"] = dr["Quantity"];
newRow["Rate"] = dr["Rate"];
newRow["Amount"] = dr["Amount"];
long quotationComponentCostId = long.Parse(dr["QuotationComponentCostId"].ToString());
newRow["Unit SubTotal"] = DataSetCalculateUtil.GetQuotationComponentCostUnitSubtotal(quotationComponentCostId, this.QuotationController);
newRow["SubTotal"] = DataSetCalculateUtil.GetQuotationComponentCostSubtotal(quotationComponentCostId, this.QuotationController);
dtCost.Rows.Add(newRow);
return dtCost;
protected override void AssignDataSourceRowValue(DataRow dataSourceRow, long entityRecordId)
#region implement Mg2ListEntityControl
protected override IDataGrid DataGrid
get { return grdQuotationComponent; }
protected override DataSetEditEntityWindow CreateEditWindow()
QuotationComponentDef quotationComponentDef = new QuotationComponentDef();
quotationComponentDef.QuotationCategoryId = this.QuotationCategoryId;
quotationComponentDef.QuotationController = this.QuotationController;
return quotationComponentDef;
#endregion
#region Rewrite Modify, Delete, Add Funciton
//Handle the logic when modify the record
private new void OnOpenEntityRecord()
if (DataGrid.ActiveDataItem == null)
string _message = ResourceUtil.GetString("UI.Common.ListWindow.SelectOneRow");
MessageBox.Show(_message);
DataSetEditEntityWindow editWindow = CreateEditWindow();
if (typeof(DataRowView).IsInstanceOfType(DataGrid.ActiveDataItem))
DataRow activeDataRow = ((DataRowView)DataGrid.ActiveDataItem).Row;
long entityRecordId = (long)activeDataRow[IdentifierName];
editWindow.EntityRecordId = entityRecordId;
editWindow.ShowDialog();
if (editWindow.IsSaved)
LoadGridData();
//this.RaiseEntityModifyEvent(editWindow.EntityRecord);
string _message = ResourceUtil.GetString("Entity.Common.DataSource.NotDataTable");
throw new Mg2Exception(_message, null, Mg2Exception.SystemErrorMinID);
//Handle the process when delete record
private new void OnDeleteEntityRecord()
if (DataGrid.ActiveDataItem == null)
string _message = ResourceUtil.GetString("UI.Common.ListWindow.SelectOneRow");
MessageBox.Show(_message);
string _confirmText = ResourceUtil.GetString("UI.Common.ListWindow.DeleteConfirmBox.Text");
string _confirmCaption = ResourceUtil.GetString("UI.Common.ListWindow.DeleteConfirmBox.Caption");
if (MessageBox.Show(_confirmText, _confirmCaption, MessageBoxButton.YesNo) == MessageBoxResult.Yes)
DataRow activeDataRow = GetActiveDataRow();
long entityRecordId = (long)activeDataRow[IdentifierName];
object entityRecord = this.QuotationController.GetEntity(_entityType, entityRecordId);
DataSetEntityDeleteUtil.QuotationDeleteFacade(entityRecord, this.QuotationController);
LoadGridData();
catch (Exception e)
WindowUtil.ShowException(e, null);
//Hanle the process when add entity
private new void OnAddEntityRecord()
DataSetEditEntityWindow editWindow = CreateEditWindow();
editWindow.ShowDialog();
if (editWindow.IsSaved)
LoadGridData();
#endregion
#region UI Element Event
private void menuAdd_Click(object sender, RoutedEventArgs e)
OnAddEntityRecord();
private void menuModify_Click(object sender, RoutedEventArgs e)
OnOpenEntityRecord();
private void menuDelete_Click(object sender, RoutedEventArgs e)
OnDeleteEntityRecord();
private void grdQuotationComponent_MouseDoubleClick(object sender, MouseButtonEventArgs e)
OnOpenEntityRecord();
private void menuComponentCost_Click(object sender, RoutedEventArgs e)
if (DataGrid.ActiveDataItem == null)
string _message = ResourceUtil.GetString("UI.Common.ListWindow.SelectOneRow");
MessageBox.Show(_message);
DataRow activeDataRow = GetActiveDataRow();
long entityRecordId = long.Parse(activeDataRow["QuotationComponentId"].ToString());
QuotationComponentCostList list = new QuotationComponentCostList();
list.quotationComponentCostListCtr.QuotationController = this.QuotationController;
list.QuotationComponentId = entityRecordId;
list.ShowDialog();
this.LoadGridData();
private void menuComponentPrice_Click(object sender, RoutedEventArgs e)
if (DataGrid.ActiveDataItem == null)
string _message = ResourceUtil.GetString("UI.Common.ListWindow.SelectOneRow");
MessageBox.Show(_message);
DataRow activeDataRow = GetActiveDataRow();
long entityRecordId = long.Parse(activeDataRow["QuotationComponentId"].ToString());
QuotationComponentPriceList list = new QuotationComponentPriceList();
list.QuotationController = this.QuotationController;
list.QuotationComponentId = entityRecordId;
list.ShowDialog();
this.LoadGridData();
private void grdQuotationComponent_InitializeRecord(object sender, Infragistics.Windows.DataPresenter.Events.InitializeRecordEventArgs e)
if (e.Record is DataRecord)
DataRecord record = (DataRecord)e.Record;
long quotationComponentId = long.Parse(record.Cells["QuotationComponentId"].Value.ToString());
foreach (DataRow categoryCostSummaryDr in _categoryCostSummaryDt.Rows)
string formula = categoryCostSummaryDr["Formula"].ToString();
double summaryValue = DataSetCalculateUtil.GetQuotationComponentSummaryValue(quotationComponentId, formula, this.QuotationController);
record.Cells[categoryCostSummaryDr["CostTypeName"].ToString()].Value = summaryValue;
private void grdQuotationComponent_CellActivating(object sender, Infragistics.Windows.DataPresenter.Events.CellActivatingEventArgs e)
long quotationComponentId = long.Parse(e.Cell.Record.Cells["QuotationComponentId"].Value.ToString());
DataRow[] drs = GetComponentPrice(quotationComponentId);
ComboBoxItemsProvider statusProvider = this.grdQuotationComponent.TryFindResource("StatusItemsProvider") as ComboBoxItemsProvider;
if (statusProvider != null)
List<ComboBoxDataItem> items = new List<ComboBoxDataItem>();
foreach (DataRow dr in drs)
items.Add(new ComboBoxDataItem(dr["QuotationComponentPriceId"], dr["price"].ToString()));
statusProvider.ItemsSource = items.ToArray();
private DataRow[] GetComponentPrice(long quotationComponentId)
string str = "QuotationComponentId = " + quotationComponentId;
DataRow[] drs = this.QuotationDataSet.QuotationComponentPrice.Select(str);
return drs;
private void grdQuotationComponent_CellUpdated(object sender, Infragistics.Windows.DataPresenter.Events.CellUpdatedEventArgs e)
if (this.grdQuotationComponent.ActiveDataItem is DataRowView)
long? quotationComponentId = (long)((DataRowView)this.grdQuotationComponent.ActiveDataItem).Row["QuotationComponentId"];
double price = double.Parse(e.Cell.Value.ToString());
CellValuePresenter cvp = CellValuePresenter.FromRecordAndField(e.Record, this.grdQuotationComponent.FieldLayouts[0].Fields["Price"]);
XamComboEditor xce = cvp.Editor as XamComboEditor;
long quotationComponentPriceId = long.Parse((((Infragistics.Windows.Editors.ComboBoxDataItem)(xce.SelectedItem)).Value).ToString());
QuotationComponent quotationComponent = (QuotationComponent)this.QuotationController.GetEntity(typeof(QuotationComponent), quotationComponentId);
if (e.Field.Name == "Quantity")
quotationComponent.Quantity = double.Parse(e.Cell.Value.ToString());
if (e.Field.Name == "Price")
quotationComponent.QuotationComponentPriceId = quotationComponentPriceId;
this.QuotationController.MemorySaveOrUpdate(quotationComponent);
LoadGridData();
#endregion
#region Handle Summary Fields
//Add summary fields
private void AddSummaryFields()
RemoveSummaryFields();
this._categoryCostSummaryDt.Clear();
this._categoryCostSummaryDt.Columns.Clear();
string[] categoryCostSummaryDtFields = { "CostTypeId", "CostTypeName", "Formula" };
foreach (string categoryCostSummaryDtField in categoryCostSummaryDtFields)
_categoryCostSummaryDt.Columns.Add(categoryCostSummaryDtField);
string categoryCostFilterString = "CostCalculateMethodId = 4 ";
if (QuotationCategoryId == null)
categoryCostFilterString += " And QuotationCategoryId is null";
categoryCostFilterString += " And QuotationCategoryId = " + this.QuotationCategoryId.Value;
this.QuotationController.QuotationDataSet.QuotationCategoryCost.DefaultView.RowFilter = categoryCostFilterString;
this.QuotationController.QuotationDataSet.QuotationCategoryCost.DefaultView.Sort = "QuotationCategoryCostId";
foreach (DataRowView categoryCostDrv in this.QuotationController.QuotationDataSet.QuotationCategoryCost.DefaultView)
DataRow newRow = _categoryCostSummaryDt.NewRow();
foreach (string fieldName in categoryCostSummaryDtFields)
newRow[fieldName] = categoryCostDrv[fieldName];
_categoryCostSummaryDt.Rows.Add(newRow);
foreach (DataRow categoryCostSummaryDr in _categoryCostSummaryDt.Rows)
AddNewUnboundField(categoryCostSummaryDr["CostTypeName"].ToString(), categoryCostSummaryDr["CostTypeName"].ToString());
AddSummaryDefinitionField(categoryCostSummaryDr["CostTypeName"].ToString());
//add dumb field
//if (this.grdQuotationCategoryCost.FieldLayouts[0].Fields.IndexOf(Constants.conDumbUnboundFieldName) == -1)
// AddNewUnboundField(Constants.conDumbUnboundFieldName, Constants.conDumbUnboundFieldName);
// AddSummaryDefinitionField(Constants.conDumbUnboundFieldName);
// this.grdList.FieldLayouts[0].Fields[Constants.conDumbUnboundFieldName].Visibility = Visibility.Hidden;
//Add unbound field
private void AddNewUnboundField(string name, string label)
UnboundField unboundField = new UnboundField();
unboundField.Name = name;
unboundField.Label = label;
//unboundField.Settings.LabelPresenterStyle
unboundField.Settings.AllowEdit = false;
unboundField.Settings.CellClickAction = CellClickAction.SelectRecord;
int indexName = this.grdQuotationComponent.FieldLayouts[0].Fields.IndexOf(name);
this.grdQuotationComponent.FieldLayouts[0].Fields.Add(unboundField);
//Add summary defintion field
private void AddSummaryDefinitionField(string name)
SummaryDefinition summaryDef = new SummaryDefinition();
summaryDef.SourceFieldName = name;
summaryDef.Calculator = SummaryCalculator.Sum;
//summaryDef.StringFormat = "{} {0:n}";
summaryDef.Key = name;
this.grdQuotationComponent.FieldLayouts[0].SummaryDefinitions.Add(summaryDef);
private void RemoveSummaryFields()
foreach (DataRow categoryCostSummaryDr in _categoryCostSummaryDt.Rows)
string summaryName = categoryCostSummaryDr["CostTypeName"].ToString();
int summaryFieldIndex = this.grdQuotationComponent.FieldLayouts[0].Fields.IndexOf(summaryName);
if (summaryFieldIndex != -1)
this.grdQuotationComponent.FieldLayouts[0].Fields.RemoveAt(summaryFieldIndex);
SummaryDefinition summaryDefinition = this.grdQuotationComponent.FieldLayouts[0].SummaryDefinitions[summaryName];
if (summaryDefinition != null)
this.grdQuotationComponent.FieldLayouts[0].SummaryDefinitions.Remove(summaryDefinition);
#endregion
checkbox 在
WPF
在
datagrid
添加
checkbox实现全选
在
WPF
在
datagrid
添加
checkbox,checkbox这个控件无法改变它的大小,至少我还没找放到方法
如果想让checkbox居
中
一下的话,可以调整他的margin如:Margin="40,35,0,0" 可以实现和数据绑定的列表
中
对齐
浏览器
中
出现如下
<UnboundField(
String
Field, (), {'label': '权限名称', 'validators': [<wtforms.validators.DataRequired
object
at 0x000001E9ED05FA90>], 'description': '权限名称', 'render_kw...
在默认情况下,
WPF
提供的
DataGrid
仅拥有数据展示等简单功能,如果要实现像Excel一样复杂的筛选过滤功能,则相对比较麻烦。本文以一个简单的小例子,简述如何通过
WPF
实话
DataGrid
的筛选功能,仅供学习分享使用,如有不足之处,还请指正。
最近项目有个需求需要动态扩展
DataGrid
,动态扩展列,cell的模板不一样,有的textbox,有的combox,并且需要后台绑定style设置datatrigger
先看combox的
DataGrid
TemplateColumn col = new
DataGrid
TemplateColumn();
var stackPanelFactory = new FrameworkElementFactory(typeof(S
最近项目
中
使用到了Grid表格,居然要加边
框
,查了一下,grid原生居然是不支持实线边
框
的。。最终我还是实现了效果,看看吧:左边是直接写的每行一个border,每列写一个border,这样...
渲染模板时,访问页面提示TypeError: 'UnboundField'
object
is not callable
检查代码,发现实例化表单类是,没有加括号:form = NewNoteForm,加了括号后就解决了form = NewNoteForm()
@app.route('/index')def index(): form = NewNoteForm no...
调用Flask-wtforms生成表单,但是在浏览器
中
出现'UnboundField'
object
is not callable, dynamic field won't init properly
Invalid field name '<UnboundField(PasswordField, ('PassWrod',), {'validators': [<wtforms.validators.DataRequired
object
at 0x1107be690>]})>'.
显示如...
将
WPF
应用程序转换为 .NET Core 3 用 .NET Core 3 创建.NET Core
WPF
应用程序的第一步是安装 .NET Core 3 。首先安装 .NET Core运行时和主机安装程序(如果尚未安装):https://github.com/dotnet/core-setup接下来,您将要安装最新的.NET Core 3 SDK(在master 3.0.x运行时标题下选择平台的安...