private void OnAddedToVisualTree() { if (Width == 0) Width = Parent.Width; if (Height == 0) Height = Parent.Height; // start monitoring CPU and memory when added Task.Factory.StartNew(() => { WatchCPUAndMemory(); }); }