<UserControl
xmlns=”http://schemas.microsoft.com/winfx/2006/xaml/presentation”
xmlns:x=”http://schemas.microsoft.com/winfx/2006/xaml”
xmlns:d=”http://schemas.microsoft.com/expression/blend/2008″
xmlns:mc=”http://schemas.openxmlformats.org/markup-compatibility/2006″
xmlns:local=”clr-namespace:NewPwr.Mes.NewProductionImport.Module.Views”
xmlns:dxg=”http://schemas.devexpress.com/winfx/2008/xaml/grid”
x:Class=”NewPwr.Mes.NewProductionImport.Module.Views.PartDistributeView”
xmlns:converters=”clr-namespace:NewPwr.Mes.NewProductionImport.Module.Converters”
xmlns:dxmvvm=”http://schemas.devexpress.com/winfx/2008/xaml/mvvm”
xmlns:dxe=”http://schemas.devexpress.com/winfx/2008/xaml/editors”
mc:Ignorable=”d”>
<UserControl.Resources>
<converters:RowHandleToRowNumberConverter x:Key=”RowHandleConverter”/>
<DataTemplate x:Key=”RowIndicatorContentTemplate”>
<StackPanel HorizontalAlignment=”Stretch” VerticalAlignment=”Stretch”>
<TextBlock Text=”{Binding Path=RowHandle.Value, Converter={StaticResource RowHandleConverter}}”
Foreground=”Black” HorizontalAlignment=”Center” VerticalAlignment=”Center”/>
</StackPanel>
</DataTemplate>
</UserControl.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height=”*”/>
</Grid.RowDefinitions>
<Grid Grid.Row=”0″>
<Grid.ColumnDefinitions>
<ColumnDefinition Width=”Auto”/>
<ColumnDefinition Width=”*”/>
</Grid.ColumnDefinitions>
<DockPanel Grid.Column=”0″>
<DockPanel DockPanel.Dock=”Top” LastChildFill=”False”>
<Label Content=”查找:”/>
<TextBox Width=”280″ Text=”{Binding SearchText}”/>
<Button Content=”执行查找” Command=”{Binding SearchCommand}”/>
</DockPanel>
<DockPanel DockPanel.Dock=”Bottom”>
<dxg:GridControl SelectionMode=”Row” ItemsSource=”{Binding PartDistributeBomList}” SelectedItem=”{Binding SelectedDistributePartBom}”>
<dxg:GridControl.View>
<dxg:TableView x:Name=”ToolTypeViewItem” AutoWidth=”True” ShowGroupPanel=”False”
ShowIndicator=”True” IndicatorWidth=”60″ ShowSearchPanelMode=”Never”
AllowColumnFiltering=”True” ShowCheckBoxSelectorColumn=”True”
RowIndicatorContentTemplate=”{StaticResource RowIndicatorContentTemplate}”/>
</dxg:GridControl.View>
<dxg:GridColumn AllowEditing=”False” FieldName=”ProductBomId” Visible=”False” Header=”产品用料BomId”/>
<dxg:GridColumn AllowEditing=”False” FieldName=”ProductId” Visible=”False” Header=”产品ID”/>
<dxg:GridColumn AllowEditing=”False” FieldName=”PartId” Visible=”False” Header=”物料Id”/>
<dxg:GridColumn AllowEditing=”False” FieldName=”PartNo” Header=”物料编号”/>
<dxg:GridColumn AllowEditing=”False” FieldName=”PartName” Header=”物料名称”/>
<dxg:GridColumn AllowEditing=”False” FieldName=”Spec” Header=”规格” />
<dxg:GridColumn AllowEditing=”False” FieldName=”Locations” Header=”位号”/>
<dxg:GridColumn AllowEditing=”False” FieldName=”Qty” Header=”数量”/>
<dxg:GridColumn AllowEditing=”False” FieldName=”Side” Header=”AB面” />
</dxg:GridControl>
</DockPanel>
</DockPanel>
<GridSplitter Background=”AliceBlue” Width=”2″/>
<DockPanel Grid.Column=”1″>
<DockPanel DockPanel.Dock=”Top” LastChildFill=”False”>
<Button DockPanel.Dock=”Left” Content=”编辑” Command=”{Binding EditCommand}” IsEnabled=”{Binding IsEnableEditBtn}”/>
<Button DockPanel.Dock=”Left” Content=”添加” Command=”{Binding AddProductPartCommand}” IsEnabled=”{Binding IsEnableAddDeleteBtn}”/>
<Button DockPanel.Dock=”Left” Content=”删除” Command=”{Binding DeleteProductPartCommand}” IsEnabled=”{Binding IsEnableAddDeleteBtn}”/>
<Button DockPanel.Dock=”Left” Content=”保存” Command=”{Binding SaveCommand}” IsEnabled=”{Binding IsEnableSaveCancelBtn}”/>
<Button DockPanel.Dock=”Left” Content=”取消” Command=”{Binding CancelCommand}” IsEnabled=”{Binding IsEnableSaveCancelBtn}”/>
</DockPanel>
<DockPanel DockPanel.Dock=”Bottom”>
<dxg:GridControl x:Name=”grid” ItemsSource=”{Binding PartDistributePartList}”>
<dxg:GridControl.DetailDescriptor>
<dxg:DataControlDetailDescriptor ItemsSourceBinding=”{Binding Section}” ShowHeader=”False”>
<dxg:GridControl>
<dxg:GridControl.DetailDescriptor>
<dxg:DataControlDetailDescriptor ShowHeader=”False” ItemsSourceBinding=”{Binding ProductProcess}”>
<dxg:GridControl>
<dxg:GridControl.DetailDescriptor>
<dxg:DataControlDetailDescriptor ShowHeader=”False” ItemsSourceBinding=”{Binding ProductStep}”>
<dxg:GridControl>
<dxg:GridControl.DetailDescriptor>
<dxg:DataControlDetailDescriptor ShowHeader=”False” ItemsSourceBinding=”{Binding ProductPart}”>
<dxg:GridControl>
<dxg:GridControl.Columns>
<dxg:GridColumn FieldName=”PartId” Header=”物料ID” Visible=”False” Width=”*”/>
<dxg:GridColumn FieldName=”PartNo” Header=”物料编号” Width=”*”/>
<dxg:GridColumn FieldName=”Locations” Header=”位号” Width=”*”/>
<dxg:GridColumn FieldName=”Qty” Header=”数量” Width=”*”/>
<dxg:GridColumn FieldName=”MustCheck” Header=”校验” Width=”*”/>
</dxg:GridControl.Columns>
<dxg:GridControl.View>
<dxg:TableView VerticalScrollbarVisibility=”Auto” NavigationStyle=”Row” ShowGroupPanel=”False”/>
</dxg:GridControl.View>
</dxg:GridControl>
</dxg:DataControlDetailDescriptor>
</dxg:GridControl.DetailDescriptor>
<dxg:GridControl.Columns>
<dxg:GridColumn FieldName=”StepName” Header=”工步” Width=”*”/>
</dxg:GridControl.Columns>
<dxg:GridControl.View>
<dxg:TableView VerticalScrollbarVisibility=”Auto” NavigationStyle=”Row” ShowGroupPanel=”False”/>
</dxg:GridControl.View>
</dxg:GridControl>
</dxg:DataControlDetailDescriptor>
</dxg:GridControl.DetailDescriptor>
<dxg:GridControl.Columns>
<dxg:GridColumn FieldName=”ProductProcessName” Header=”工序” Width=”*”/>
</dxg:GridControl.Columns>
<dxg:GridControl.View>
<dxg:TableView VerticalScrollbarVisibility=”Auto” NavigationStyle=”Row”
ShowGroupPanel=”False”/>
</dxg:GridControl.View>
</dxg:GridControl>
</dxg:DataControlDetailDescriptor>
</dxg:GridControl.DetailDescriptor>
<dxg:GridControl.Columns>
<dxg:GridColumn FieldName=”SectionName” Header=”工段” Width=”*”/>
</dxg:GridControl.Columns>
<dxg:GridControl.View>
<dxg:TableView VerticalScrollbarVisibility=”Auto” NavigationStyle=”Row” ShowGroupPanel=”False”/>
</dxg:GridControl.View>
</dxg:GridControl>
</dxg:DataControlDetailDescriptor>
</dxg:GridControl.DetailDescriptor>
<dxg:GridControl.View>
<dxg:TableView AllowPerPixelScrolling=”True” x:Name=”view” DetailHeaderContent=”工艺流程测试”>
<dxmvvm:Interaction.Triggers>
<dxmvvm:EventToCommand EventName=”Loaded” CommandParameter=”1″ ProcessEventsFromDisabledEventOwner=”True”
Command=”{Binding Commands.ExpandMasterRow, ElementName=view}” />
</dxmvvm:Interaction.Triggers>
</dxg:TableView>
</dxg:GridControl.View>
<dxg:GridControl.Columns>
<dxg:GridColumn FieldName=”Name” Header=”工艺流程” ReadOnly=”True” MinWidth=”60″ Width=”*” />
</dxg:GridControl.Columns>
</dxg:GridControl>
</DockPanel>
</DockPanel>
</Grid>
</Grid>
</UserControl>
主从表数据展开
/// <summary>
/// 展开masterdetail主从表展开
/// </summary>
/// <param name=”sender”></param>
/// <param name=”e”></param>
private void GridControlMain_Loaded(object sender, RoutedEventArgs e)
{
var gctrl = (GridControl)sender;
for (int i = 0; i < gctrl.VisibleRowCount; i++)
{
gctrl.ExpandMasterRow(gctrl.GetRowHandleByListIndex(i),de);
}
}
原创文章,作者:6024010,如若转载,请注明出处:https://blog.ytso.com/269824.html