WPF DataGrid中嵌入Combobox

这篇博客展示了如何在WPF的DataGrid中嵌入ComboBox控件,使用Infragistics的XamDataGrid组件,详细配置了各字段的编辑样式,并提供了添加、修改和删除的上下文菜单操作。
摘要由CSDN通过智能技术生成

页面

<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>

        <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>

 

评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值