dev master—detail 主表和明细的具体使用案例
2022/6/23 23:20:30
本文主要是介绍dev master—detail 主表和明细的具体使用案例,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
<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);
} }
这篇关于dev master—detail 主表和明细的具体使用案例的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!
- 2024-12-22程序员出海做 AI 工具:如何用 similarweb 找到最佳流量渠道?
- 2024-12-20自建AI入门:生成模型介绍——GAN和VAE浅析
- 2024-12-20游戏引擎的进化史——从手工编码到超真实画面和人工智能
- 2024-12-20利用大型语言模型构建文本中的知识图谱:从文本到结构化数据的转换指南
- 2024-12-20揭秘百年人工智能:从深度学习到可解释AI
- 2024-12-20复杂RAG(检索增强生成)的入门介绍
- 2024-12-20基于大型语言模型的积木堆叠任务研究
- 2024-12-20从原型到生产:提升大型语言模型准确性的实战经验
- 2024-12-20啥是大模型1
- 2024-12-20英特尔的 Lunar Lake 计划:一场未竟的承诺