DetailsViewDesigner.PreFilterProperties(IDictionary) Metod
Definition
Viktigt
En del information gäller för förhandsversionen av en produkt och kan komma att ändras avsevärt innan produkten blir allmänt tillgänglig. Microsoft lämnar inga garantier, uttryckliga eller underförstådda, avseende informationen som visas här.
Används av designern för att ta bort egenskaper från eller lägga till egenskaper till visningen i rutnätet Properties eller för skuggegenskaper för den associerade kontrollen.
protected:
override void PreFilterProperties(System::Collections::IDictionary ^ properties);
protected override void PreFilterProperties(System.Collections.IDictionary properties);
override this.PreFilterProperties : System.Collections.IDictionary -> unit
Protected Overrides Sub PreFilterProperties (properties As IDictionary)
Parametrar
- properties
- IDictionary
En samling som implementerar de IDictionary tillagda och skuggade egenskaperna.
Exempel
Följande kodexempel visar hur du åsidosätter PreFilterProperties metoden i en klass som ärvs från DetailsViewDesigner klassen för att ändra rutnätet Properties för DetailsView kontrollen vid designtillfället. Exemplet gör egenskapen NamingContainer synlig i rutnätet Properties .
// Shadow the control properties with design-time properties.
protected override void PreFilterProperties(IDictionary properties)
{
// Call the base method first.
base.PreFilterProperties(properties);
// Make the NamingContainer visible in the Properties grid.
PropertyDescriptor selectProp =
(PropertyDescriptor)properties["NamingContainer"];
properties["NamingContainer"] =
TypeDescriptor.CreateProperty(selectProp.ComponentType,
selectProp, BrowsableAttribute.Yes);
} // PreFilterProperties
' Shadow the control properties with design-time properties.
Protected Overrides Sub PreFilterProperties( _
ByVal properties As IDictionary)
' Call the base method first.
MyBase.PreFilterProperties(properties)
' Make the NamingContainer visible in the Properties grid.
Dim selectProp As PropertyDescriptor = _
CType(properties("NamingContainer"), PropertyDescriptor)
properties("NamingContainer") = _
TypeDescriptor.CreateProperty(selectProp.ComponentType, _
selectProp, BrowsableAttribute.Yes)
End Sub
Kommentarer
Kontrolldesigners använder metoder som härleds från ComponentDesigner.PreFilterProperties metoden för att skugga olika kontrollegenskaper med motsvarande designtidsegenskaper som designern implementerar och för att lägga till egenskaper i eller ta bort egenskaper från rutnätet Properties .
DetailsView För kontrollen PreFilterProperties anger BrowsableAttribute metoden objektet Fields för egenskapen till false när kontrollen är i mallläge. Detta säkerställer att en kolumn som är i mallläge inte kan tas bort med hjälp av Fields dialogrutan.
Anteckningar till arvingar
Åsidosätt PreFilterProperties(IDictionary) metoden för att lägga till egenskaper i eller ändra attribut för egenskaper i egenskapssamlingen design-time. Var noga med att anropa basmetoden innan du utför annan bearbetning.