반응형
devexpresss fixed column 방법

고정하고 싶은 컬럼에 Fixed="Left" 을 추가해준다.
여러 컬럼을 고정하고 싶으면, 고정하고 싶은 컬럼 다 추가해준다.
왼쪽은 "Left", 오른쪽은 "Right"로 하면된다.
고정된 컬럼과 비고정 컬럼의 구분 라인은 View에 FixedLineWidth="5" 을 추가하면된다.
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 | < 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.Grid12ColumnFixed" 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 = "Grid" View = "GroupBox" HorizontalAlignment = "Stretch" Height = "500" > < dxg:GridControl x:Name = "gcGrid" SelectionMode = "Cell" > < dxg:GridControl.Columns > < dxg:GridColumn FieldName = "SalesOrderID" Header = "SalesOrderID" Width = "100" Fixed = "Left" /> < dxg:GridColumn FieldName = "CustomerID" Header = "CustomerID" Width = "100" Fixed = "Left" /> < dxg:GridColumn FieldName = "RevisionNumber" Header = "RevisionNumber" Width = "100" Fixed = "Left" /> < dxg:GridColumn FieldName = "OrderDate" Header = "OrderDate" Width = "100" /> < dxg:GridColumn FieldName = "DueDate" Header = "DueDate" Width = "100" /> < dxg:GridColumn FieldName = "ShipDate" Header = "ShipDate" Width = "100" /> < dxg:GridColumn FieldName = "Status" Header = "Status" Width = "100" /> < dxg:GridColumn FieldName = "OnlineOrderFlag" Header = "OnlineOrderFlag" Width = "100" /> < dxg:GridColumn FieldName = "SalesOrderNumber" Header = "SalesOrderNumber" Width = "100" /> < dxg:GridColumn FieldName = "PurchaseOrderNumber" Header = "PurchaseOrderNumber" Width = "100" /> < dxg:GridColumn FieldName = "AccountNumber" Header = "AccountNumber" Width = "100" /> < dxg:GridColumn FieldName = "CustomerID" Header = "CustomerID" Width = "100" /> < dxg:GridColumn FieldName = "SalesPersonID" Header = "SalesPersonID" Width = "100" /> < dxg:GridColumn FieldName = "TerritoryID" Header = "TerritoryID" Width = "100" /> < dxg:GridColumn FieldName = "BillToAddressID" Header = "BillToAddressID" Width = "100" /> < dxg:GridColumn FieldName = "ShipToAddressID" Header = "ShipToAddressID" Width = "100" /> < dxg:GridColumn FieldName = "ShipMethodID" Header = "ShipMethodID" Width = "100" /> < dxg:GridColumn FieldName = "CreditCardID" Header = "CreditCardID" Width = "100" /> < dxg:GridColumn FieldName = "CreditCardApprovalCode" Header = "CreditCardApprovalCode" Width = "100" /> < dxg:GridColumn FieldName = "CurrencyRateID" Header = "CurrencyRateID" Width = "100" /> < dxg:GridColumn FieldName = "SubTotal" Header = "SubTotal" Width = "100" /> < dxg:GridColumn FieldName = "TaxAmt" Header = "TaxAmt" Width = "100" /> < dxg:GridColumn FieldName = "Freight" Header = "Freight" Width = "100" /> < dxg:GridColumn FieldName = "TotalDue" Header = "TotalDue" Width = "100" Fixed = "Right" /> < dxg:GridColumn FieldName = "Comment" Header = "Comment" Width = "100" Fixed = "Right" /> < dxg:GridColumn FieldName = "ModifiedDate" Header = "ModifiedDate" Width = "100" Fixed = "Right" /> </ dxg:GridControl.Columns > < dxg:GridControl.View > < dxg:TableView AllowScrollAnimation = "True" AllowEditing = "False" AllowFixedColumnMenu = "True" FixedLineWidth = "5" /> </ dxg:GridControl.View > </ dxg:GridControl > </ 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 | using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; using System.Windows.Data; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Navigation; using System.Windows.Shapes; using BIZ.Common.Dac; namespace WpfSample.DevTest { /// <summary> /// Grid12ColumnFixed.xaml에 대한 상호 작용 논리 /// </summary> public partial class Grid12ColumnFixed : Page { public Grid12ColumnFixed() { InitializeComponent(); GetBindGrid(); } private void GetBindGrid() { Dictionary< string , object > dic = new Dictionary< string , object >(); dic.Add( "param1" , "111" ); var data = ( new ADOConnect()).GetDataSet( "AdventureWorks2016" , "Z_UP_SALES_ORDER2_LIST" , dic); gcGrid.ItemsSource = data.Tables[0]; } private void Button_Click( object sender, RoutedEventArgs e) { GetBindGrid(); } } } |
반응형
'WPF - DevExpress' 카테고리의 다른 글
WPF & DevExpress GridControl Master Detail Grid current data row (2) | 2021.04.04 |
---|---|
WPF & DevExpress GridControl Dynamic Add Columns (2) | 2021.04.03 |
WPF & DevExpress GridControl Context Menu (4) | 2021.04.02 |
WPF & DevExpress GridControl Move to next cell (6) | 2021.04.01 |
WPF & DevExpress GridControl RowColor #2 dynamic (4) | 2021.03.30 |
댓글