Freelance Project Requests info@CodeDocu.de Software Development in C# WPF Asp.Net Core Vba Excel Word SQL-Server EF Linq, UWP Net
#

WPF: Reset all children element
 
How to delete all subelements in a panel?
How do you delete all the elements images into a panel or grid?
 
Solution:
Using .Children.Clear (); You can delete all child elements in WPF.
Then you can make a .UpdateLayout.

//< reset >
panel_Folders.Children.Clear();
//</ reset >

 
 
If you want to fill a panel or grid at runtime and want to update it later, you have to delete the content of the FrameworkElement and fill it again, because otherwise the content is loaded twice.
 
Code Example for deleting and reloading a panel

//< reset >
panel_Folders.Children.Clear();
panel_Folders.UpdateLayout();
arrFolder_Dates = new List<string>(); //internal memory
//</ reset >
 
//< load >
read_Folder_Main(tbxFolder.Text);
//</ load >

 
 
 
Problem with Children.Clear ()
You can flush a subset of WPF elements like a panel with Children.Clear ().

 
After the Childeren.Clear no reload is displayed

 
 
You can delete individual elements with Remove (Child) or RemoveRange (position, number)

panel_Folders.Children.RemoveRange(0,3);

 
The subsequent UpdateLayout () is not always necessary.

panel_Folders.Children.Clear();
panel_Folders.UpdateLayout();

 
Mobile
»
WPF Datagrid: Set Color of Row when it has no Focus
»
WPF Datagrid: Change the Color of Selected Row
»
WPF: Change Selected Row Color in DataGrid
»
WPF: Read SelectedItem from DataGrid with Dynamic As Anonymous Type
»
WPF: Elements too wide, edge Cut off
»
Solved: System.InvalidCastException HResult 0x80004002 in Select DataGrid
»
WPF: Combobox Selected Value
»
WPF Datagrid: Column is not displayed
»
WPF: Show video in preview
»
WPF Webbrowser: Suppress Java Errors or Set WebBrowser to Silent

.

Contact for Jobs, Project Requests: raimund.popp@microsoft-programmierer.de