반응형
많이 쓰는 형태의 master, detail 형태의 그리드.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 | < Page xmlns = "http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x = "http://schemas.microsoft.com/winfx/2006/xaml" xmlns:mc = "http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d = "http://schemas.microsoft.com/expression/blend/2008" xmlns:local = "clr-namespace:WpfSample.DevTest" xmlns:dxlc = "http://schemas.devexpress.com/winfx/2008/xaml/layoutcontrol" xmlns:dx = "http://schemas.devexpress.com/winfx/2008/xaml/core" xmlns:Serialization = "clr-namespace:DevExpress.Xpf.LayoutControl.Serialization;assembly=DevExpress.Xpf.LayoutControl.v17.2" xmlns:dxe = "http://schemas.devexpress.com/winfx/2008/xaml/editors" xmlns:dxg = "http://schemas.devexpress.com/winfx/2008/xaml/grid" x:Class = "WpfSample.DevTest.Grid14MasterDetail" mc:Ignorable = "d" d:DesignHeight = "800" d:DesignWidth = "1280" Title = "Grid01" > < StackPanel Margin = "0,10,10,10" > < dxlc:LayoutControl HorizontalAlignment = "Stretch" VerticalAlignment = "Stretch" Orientation = "Vertical" > < dxlc:LayoutGroup Header = "Button" View = "GroupBox" HorizontalAlignment = "Stretch" > < dx:SimpleButton x:Name = "btnSearch" Content = "Search" HorizontalAlignment = "Left" Click = "Button_Click" /> </ dxlc:LayoutGroup > </ dxlc:LayoutControl > < dxlc:LayoutControl HorizontalAlignment = "Stretch" VerticalAlignment = "Stretch" Orientation = "Vertical" > < dxlc:LayoutGroup Header = "Content" View = "GroupBox" HorizontalAlignment = "Stretch" > < Grid > < Grid.ColumnDefinitions > < ColumnDefinition Width = "600" /> < ColumnDefinition Width = "600" /> </ Grid.ColumnDefinitions > < Grid.RowDefinitions > < RowDefinition Height = "300" /> < RowDefinition Height = "250" /> </ Grid.RowDefinitions > < dxg:GridControl Grid.Column = "0" Grid.Row = "0" x:Name = "gcGrid" > < dxg:GridControl.Columns > < dxg:GridColumn FieldName = "CocktailNo" Header = "CocktailNo" Width = "110" ReadOnly = "True" /> < dxg:GridColumn FieldName = "CocktailNmKR" Header = "CocktailNmKR" Width = "100" ReadOnly = "True" /> < dxg:GridColumn FieldName = "CocktailNmEn" Header = "CocktailNmEn" Width = "100" ReadOnly = "True" /> < dxg:GridColumn FieldName = "CocktailScore" Header = "CocktailScore" Width = "100" ReadOnly = "True" /> < dxg:GridColumn FieldName = "Remark" Header = "Remark" Width = "100" ReadOnly = "True" /> </ dxg:GridControl.Columns > < dxg:GridControl.View > < dxg:TableView x:Name = "tvViewGrid" NavigationStyle = "Row" ShowGroupPanel = "False" AutoWidth = "True" FocusedRowChanged = "TvViewGrid_FocusedRowChanged" /> </ dxg:GridControl.View > </ dxg:GridControl > < StackPanel Grid.Column = "1" Grid.Row = "0" > < dxlc:LayoutControl HorizontalAlignment = "Stretch" VerticalAlignment = "Stretch" Orientation = "Vertical" > < dxlc:LayoutGroup Header = "Edit" View = "GroupBox" HorizontalAlignment = "Stretch" Orientation = "Vertical" DataContext = "{Binding Path=SelectedItem, ElementName=gcGrid}" > < dxlc:LayoutItem Label = "CocktailNo" > < dxe:TextEdit HorizontalAlignment = "Left" Margin = "0,0,0,0" VerticalAlignment = "Top" Width = "150" Text = "{Binding CocktailNo}" /> </ dxlc:LayoutItem > < dxlc:LayoutItem Label = "CocktailNmKR" > < dxe:TextEdit HorizontalAlignment = "Left" Margin = "0,0,0,0" VerticalAlignment = "Top" Width = "150" Text = "{Binding CocktailNmKR}" /> </ dxlc:LayoutItem > < dxlc:LayoutItem Label = "CocktailNmEn" > < dxe:TextEdit HorizontalAlignment = "Left" Margin = "0,0,0,0" VerticalAlignment = "Top" Width = "150" Text = "{Binding CocktailNmEn}" /> </ dxlc:LayoutItem > < dxlc:LayoutItem Label = "CocktailScore" > < dxe:TextEdit HorizontalAlignment = "Left" Margin = "0,0,0,0" VerticalAlignment = "Top" Width = "150" Text = "{Binding CocktailScore}" /> </ dxlc:LayoutItem > < dxlc:LayoutItem Label = "Remark" > < dxe:TextEdit HorizontalAlignment = "Left" Margin = "0,0,0,0" VerticalAlignment = "Top" Width = "150" Text = "{Binding Remark}" /> </ dxlc:LayoutItem > </ dxlc:LayoutGroup > </ dxlc:LayoutControl > </ StackPanel > < dxg:GridControl Grid.Column = "0" Grid.Row = "1" Grid.ColumnSpan = "2" x:Name = "gcGridDetail" > < dxg:GridControl.Columns > < dxg:GridColumn FieldName = "CocktailNo" Header = "CocktailNo" Width = "110" ReadOnly = "True" /> < dxg:GridColumn FieldName = "CocktailMaterialNo" Header = "CocktailMaterialNo" Width = "110" ReadOnly = "True" /> < dxg:GridColumn FieldName = "MaterialCode" Header = "MaterialCode" Width = "110" ReadOnly = "True" /> < dxg:GridColumn FieldName = "MaterialName" Header = "MaterialName" Width = "110" ReadOnly = "True" /> < dxg:GridColumn FieldName = "MaterialQuantity" Header = "MaterialQuantity" Width = "110" ReadOnly = "True" /> < dxg:GridColumn FieldName = "MaterialUnit" Header = "MaterialUnit" Width = "110" ReadOnly = "True" /> < dxg:GridColumn FieldName = "Remark" Header = "Remark" Width = "110" ReadOnly = "True" /> < dxg:GridColumn FieldName = "UnitPrice" Header = "UnitPrice" Width = "110" ReadOnly = "True" /> < dxg:GridColumn FieldName = "CreateUser" Header = "CreateUser" Width = "110" ReadOnly = "True" /> < dxg:GridColumn FieldName = "CreateDate" Header = "CreateDate" Width = "110" ReadOnly = "True" /> < dxg:GridColumn FieldName = "UpdateUser" Header = "UpdateUser" Width = "110" ReadOnly = "True" /> < dxg:GridColumn FieldName = "UpdateDate" Header = "UpdateDate" Width = "110" ReadOnly = "True" /> </ dxg:GridControl.Columns > < dxg:GridControl.View > < dxg:TableView x:Name = "tvViewCommon" NavigationStyle = "Row" ShowGroupPanel = "False" AutoWidth = "True" /> </ dxg:GridControl.View > </ dxg:GridControl > </ Grid > </ dxlc:LayoutGroup > </ dxlc:LayoutControl > </ StackPanel > </ Page > |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 | using System; using System.Collections.Generic; using System.Windows; using System.Windows.Controls; using BIZ.Common.Dac; namespace WpfSample.DevTest { /// <summary> /// Grid14MasterDetail.xaml에 대한 상호 작용 논리 /// </summary> public partial class Grid14MasterDetail : Page { public Grid14MasterDetail() { InitializeComponent(); GetBindGrid(); } private void GetBindGrid() { Dictionary< string , object > dic = new Dictionary< string , object >(); dic.Add( "ComCode" , "111" ); var data = ( new ADOConnect()).GetDataSet( "Kaishaku" , "Z_UP_COCKTAIL_LIST" , dic); gcGrid.ItemsSource = data.Tables[0]; } private void GetBindGridDetail( string param1) { Dictionary< string , object > dic = new Dictionary< string , object >(); dic.Add( "PARAM1" , param1); var data = ( new ADOConnect()).GetDataSet( "Kaishaku" , "Z_UP_COCKTAIL_MAT_LIST" , dic); gcGridDetail.ItemsSource = data.Tables[0]; } private void Button_Click( object sender, RoutedEventArgs e) { GetBindGrid(); } private void TvViewGrid_FocusedRowChanged( object sender, DevExpress.Xpf.Grid.FocusedRowChangedEventArgs e) { GetBindGridDetail(gcGrid.GetCellValue(tvViewGrid.FocusedRowHandle, "CocktailNo" ).ToString()); } } } |
반응형
'WPF - DevExpress' 카테고리의 다른 글
WPF & DevExpress mask (0) | 2021.04.11 |
---|---|
WPF & DevExpress TreeView (0) | 2021.04.10 |
WPF & DevExpress GridControl Dynamic Add Columns (2) | 2021.04.03 |
WPF & DevExpress GridControl Column Fixed (6) | 2021.04.03 |
WPF & DevExpress GridControl Context Menu (4) | 2021.04.02 |
댓글