UIElementCollection.Clear Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Removes all elements from a UIElementCollection.
public:
virtual void Clear();
public virtual void Clear ();
abstract member Clear : unit -> unit
override this.Clear : unit -> unit
Public Overridable Sub Clear ()
Implements
Examples
The following example uses the Clear method to clear child content from a parent StackPanel. You do this by using the Children property, which is of type UIElementCollection.
void AddButton(object sender, MouseButtonEventArgs e)
{
sp1.Children.Clear();
btn = new Button();
btn.Content = "New Button";
sp1.Children.Add(btn);
}
Applies to
See also
التعاون معنا على GitHub
يمكن العثور على مصدر هذا المحتوى على GitHub حيث يمكنك أيضاً إضافة مشاكل وطلبات سحب ومراجعتها. للحصول على معلومات إضافية، اطلع على دليل المساهم لدينا.