🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: alt.pl.comp.lang.csharp
Article #342

Re: DataGrid - jak przestawiać kolumny ?

#342
From: Marek Zgadzaj
Date: Mon, 05 Jan 2004 19:20
68 lines
4231 bytes
Użytkownik "Marthy" <mar...@poczta.onet.pl> napisał w wiadomości
news:bt37jh$jrf$1@atlantis.news.tpi.pl...
[..]
> Mozesz do tego uzyc klas DataGridTableStyle i DataGridColumnStyle oraz
> wlasciwosci DataGrid.TableStyles

Marcinie,

Dość długo ten problem maglowałem ale nie wydaje się aby to było możliwe za
pomocą ww. styli. Przede wszystkim nie ma (tzn, ja nie znalazłem), żadnej
własności, któraby cokolwiek miała wspólnego ze zmianą kolejności kolumn.

Przekopałem dokumentację próbując wyszukać informacje dotyczące "moving"
"reorder" "order" "column" itp. w różnych kombinacjach. Jedyne informacje
jakie znalazłem na nt. kolejności kolumn, w kontekście klasy DataGrid są
takie:

1. O kolejności kolumn decyduje kolejność ich zdefiniowania w Kolekcji, o
ile te kolumny są definiowane w kodzie (np. ręcznie lub za pomocą IDE).
2. W przypadku generowania kolumn automatycznie nie ma tych kolumn w
Kolekcji.

Odpowiedni fragment jest taki:
======== Fragment oposu z GridTableCollection Members =====================

You can also manually control which columns appear in the DataGrid control
by setting the AutoGenerateColumns property to false and then listing the
columns that you want to include between the opening and closing <Columns>
tags. The columns specified are added to the Columns collection in the order
listed. This allows you to programmatically control the columns in the
DataGrid control.

  Note   The order that the columns are displayed in the DataGrid control is
controlled by the order that the columns appear in the Columns collection.
Although you can programmatically change the order of the columns by
manipulating the Columns collection, it is easier to list the columns in the
desired display order.
Explicitly declared columns can be displayed in conjunction with
automatically generated columns. When using both, explicitly declared
columns will be rendered first, followed by the automatically generated
columns.

  Note   Automatically generated columns are not added to the Columns
collection.
================ Koniec fragmentu ===========================

Dalej następują własności, z których żadna nie dotyczy ewentualnej zmiany
kolejności kolumn.

Początkowo sądziłem, że skoro generuję kolumny automatycznie no to niewiele
mogę zrobić. Więc zdefiniowałem kolumny samemu i wynik jest ten sam., Tzn.
nie mogę zmienić kolejności kolumn przez przeciąganie myszką.

Mogę zmienić kolejność przez ponowne zbudowanie kolekcji ale chodzi o zmianę
dynamiczną.

Wiele innych cech kolumn można zmieniać i prawie wszystkim towarzyszy
wygenerowanie odpowiedniego zdarzenia. Przeszukałem zdarzenia związane z
DataGrid i kolumnami - nie istnieje  żadne zdarzenie informujące o tym, że
kolumna ma zmieniane swoje położenie.

Nie przypuszczam, aby to było niemożliwe, ale dla mnie jest niemożliwym to
znaleźć. Dlatego znowu proszę Cię o radę, napisz dokładniej, która własność
decyduje o możliwości zmieniania kolejności kolumn.

Pozdrawiam,
Marek
Technical Details
Message-ID: <btcde8$rad$1@inews.gazeta.pl>
Path: mbox-mo1.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-03!sn-xit-04!sn-xit-01!sn-xit-05!sn-xit-06!sn-xit-08!supernews.com!news.tele.dk!news.tele.dk!small.news.tele.dk!proxad.net!newsfeed.tpinternet.pl!newsfeed.gazeta.pl!news.gazeta.pl!not-for-mail
References: <bsv467$pkp$1@inews.gazeta.pl> <bt37jh$jrf$1@atlantis.news.tpi.pl>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-03!sn-xit-04!sn-xit-01!sn-xit-05!sn-xit-06!sn-xit-08!supernews.com!news.tele.dk!news.tele.dk!small.news.tele.dk!proxad.net!newsfeed.tpinternet.pl!newsfeed.gazeta.pl!news.gazeta.pl!not-for-mail
From: "Marek Zgadzaj" <zga...@interia.pl>
Newsgroups: alt.pl.comp.lang.csharp
Subject: Re: DataGrid - jak przestawiać kolumny ?
Date: Mon, 5 Jan 2004 20:20:38 +0100
Organization: Portal Gazeta.pl -> http://www.gazeta.pl
Lines: 70
Message-ID: <btcde8$rad$1@inews.gazeta.pl>
References: <bsv467$pkp$1@inews.gazeta.pl> <bt37jh$jrf$1@atlantis.news.tpi.pl>
NNTP-Posting-Host: garizim.media4.pl
Mime-Version: 1.0
X-Trace: inews.gazeta.pl 1073330440 27981 62.233.177.110 (5 Jan 2004 19:20:40 GMT)
X-Complaints-To: use...@agora.pl
NNTP-Posting-Date: Mon, 5 Jan 2004 19:20:40 +0000 (UTC)
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106
X-Priority: 3
X-Newsreader: Microsoft Outlook Express 6.00.2800.1106
X-User: sp6nin
X-MSMail-Priority: Normal
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit