PropertyGrid.PropertySort Eigenschap
Definitie
Belangrijk
Bepaalde informatie heeft betrekking op een voorlopige productversie die aanzienlijk kan worden gewijzigd voordat deze wordt uitgebracht. Microsoft biedt geen enkele expliciete of impliciete garanties met betrekking tot de informatie die hier wordt verstrekt.
Hiermee haalt u het type sorteerbewerking op of stelt u dit PropertyGrid in om eigenschappen weer te geven.
public:
property System::Windows::Forms::PropertySort PropertySort { System::Windows::Forms::PropertySort get(); void set(System::Windows::Forms::PropertySort value); };
public System.Windows.Forms.PropertySort PropertySort { get; set; }
member this.PropertySort : System.Windows.Forms.PropertySort with get, set
Public Property PropertySort As PropertySort
Waarde van eigenschap
Een van de PropertySort waarden. De standaardwaarde is Categorized of Alphabetical.
Uitzonderingen
De toegewezen waarde is geen van de PropertySort waarden.
Voorbeelden
In het volgende codevoorbeeld ziet u hoe u een PropertyGrid besturingselement initialiseert met behulp van de PropertySortToolbarVisible eigenschappen. Daarnaast stelt dit voorbeeld de eigenschap van Visible het PropertyGrid besturingselement in op false zodat het raster niet zichtbaar is wanneer het voorbeeld wordt uitgevoerd. Als u dit voorbeeld wilt uitvoeren, plakt u de volgende code in een formulier en roept u de methode aan vanuit de InitializePropertyGrid constructor- of Load gebeurtenisafhandelingsmethode van het formulier. Als u het eigenschappenraster wilt weergeven wanneer het formulier wordt uitgevoerd, wijzigt u de eigenschap van Visible het raster in true, compileert u het opnieuw en voert u het formulier opnieuw uit.
// Declare a propertyGrid.
internal:
PropertyGrid^ propertyGrid1;
private:
// Initialize propertyGrid1.
[PermissionSetAttribute(SecurityAction::Demand, Name="FullTrust")]
void InitializePropertyGrid()
{
propertyGrid1 = gcnew PropertyGrid;
propertyGrid1->Name = "PropertyGrid1";
propertyGrid1->Location = System::Drawing::Point( 185, 20 );
propertyGrid1->Size = System::Drawing::Size( 150, 300 );
propertyGrid1->TabIndex = 5;
// Set the sort to alphabetical and set Toolbar visible
// to false, so the user cannot change the sort.
propertyGrid1->PropertySort = PropertySort::Alphabetical;
propertyGrid1->ToolbarVisible = false;
propertyGrid1->Text = "Property Grid";
// Add the PropertyGrid to the form, but set its
// visibility to False so it will not appear when the form loads.
propertyGrid1->Visible = false;
this->Controls->Add( propertyGrid1 );
}
// Declare a propertyGrid.
internal PropertyGrid propertyGrid1;
// Initialize propertyGrid1.
private void InitializePropertyGrid()
{
propertyGrid1 = new PropertyGrid();
propertyGrid1.Name = "PropertyGrid1";
propertyGrid1.Location = new System.Drawing.Point(185, 20);
propertyGrid1.Size = new System.Drawing.Size(150, 300);
propertyGrid1.TabIndex = 5;
// Set the sort to alphabetical and set Toolbar visible
// to false, so the user cannot change the sort.
propertyGrid1.PropertySort = PropertySort.Alphabetical;
propertyGrid1.ToolbarVisible = false;
propertyGrid1.Text = "Property Grid";
// Add the PropertyGrid to the form, but set its
// visibility to False so it will not appear when the form loads.
propertyGrid1.Visible = false;
this.Controls.Add(propertyGrid1);
}
'Declare a propertyGrid.
Friend WithEvents propertyGrid1 As PropertyGrid
'Initialize propertyGrid1.
Private Sub InitializePropertyGrid()
propertyGrid1 = New PropertyGrid
propertyGrid1.Name = "PropertyGrid1"
propertyGrid1.Location = New Point(185, 20)
propertyGrid1.Size = New System.Drawing.Size(150, 300)
propertyGrid1.TabIndex = 5
'Set the sort to alphabetical and set Toolbar visible
'to false, so the user cannot change the sort.
propertyGrid1.PropertySort = PropertySort.Alphabetical
propertyGrid1.ToolbarVisible = False
propertyGrid1.Text = "Property Grid"
' Add the PropertyGrid to the form, but set its
' visibility to False so it will not appear when the form loads.
propertyGrid1.Visible = False
Me.Controls.Add(propertyGrid1)
End Sub
Opmerkingen
Wanneer u de PropertySort eigenschap instelt, wordt het uiterlijk van de sorteerknoppen van de eigenschap in het raster aangepast aan de huidige status van de eigenschap. De instelling PropertySort zorgt PropertySort.NoSort ervoor dat de eigenschappen worden weergegeven in de volgorde waarin ze zijn opgehaald.
Instellen PropertySort op beide Alphabetical en Categorized is hetzelfde als de instelling PropertySortCategorized alleen. De gecategoriseerde weergave wordt altijd als alfabetisch weergegeven.
Note
Als u aangepaste sortering wilt uitvoeren, implementeert ICustomTypeDescriptor u het onderdeel om de eigenschappen in de gewenste volgorde te retourneren.