BindingList<T>.AllowEdit Propriedade
Definição
Importante
Algumas informações dizem respeito a um produto pré-lançado que pode ser substancialmente modificado antes de ser lançado. A Microsoft não faz garantias, de forma expressa ou implícita, em relação à informação aqui apresentada.
Recebe ou define um valor que indica se os itens da lista podem ser editados.
public:
property bool AllowEdit { bool get(); void set(bool value); };
public bool AllowEdit { get; set; }
member this.AllowEdit : bool with get, set
Public Property AllowEdit As Boolean
Valor de Propriedade
true se os itens da lista puderem ser editados; caso contrário, false. A predefinição é true.
Exemplos
O seguinte exemplo de código demonstra como definir a AllowEdit propriedade. Para o exemplo completo, veja o tópico de resumo BindingList<T> da aula.
// Declare a new BindingListOfT with the Part business object.
BindingList<Part> listOfParts;
void InitializeListOfParts()
{
// Create the new BindingList of Part type.
listOfParts = new BindingList<Part>
{
// Allow new parts to be added, but not removed once committed.
AllowNew = true,
AllowRemove = false,
// Raise ListChanged events when new parts are added.
RaiseListChangedEvents = true,
// Do not allow parts to be edited.
AllowEdit = false
};
// Add a couple of parts to the list.
listOfParts.Add(new Part("Widget", 1234));
listOfParts.Add(new Part("Gadget", 5647));
}
' Declare a new BindingListOfT with the Part business object.
Private WithEvents listOfParts As BindingList(Of Part)
Private Sub InitializeListOfParts()
' Create the new BindingList of Part type.
listOfParts = New BindingList(Of Part)
' Allow new parts to be added, but not removed once committed.
listOfParts.AllowNew = True
listOfParts.AllowRemove = False
' Raise ListChanged events when new parts are added.
listOfParts.RaiseListChangedEvents = True
' Do not allow parts to be edited.
listOfParts.AllowEdit = False
' Add a couple of parts to the list.
listOfParts.Add(New Part("Widget", 1234))
listOfParts.Add(New Part("Gadget", 5647))
End Sub
Observações
A AllowEdit propriedade é normalmente usada por outros componentes para determinar se a edição de itens da lista é permitida. Quando AllowEdit é definido para um novo valor, ocorre um ListChanged evento do tipo Reset .