public IRxHostElement Run()
        {
            _component = _component ?? InitializeComponent(RxApplication.Instance.ComponentLoader.LoadComponent <T>());

            RxApplication.Instance.ComponentLoader.ComponentAssemblyChanged += OnComponentAssemblyChanged;

            OnLayout();

            if (ContainerPage == null)
            {
                throw new InvalidOperationException($"Component {_component.GetType()} doesn't render a page as root");
            }

            return(this);
        }
        public void Run()
        {
            _component = _component ?? RxApplication.Instance.ComponentLoader.LoadComponent <T>();
            if (_component != null)
            {
                _componentInitializer?.Invoke((T)_component);
            }

            RxApplication.Instance.ComponentLoader.ComponentAssemblyChanged += OnComponentAssemblyChanged;

            OnLayout();

            if (_componentPage == null)
            {
                throw new InvalidOperationException($"Component {_component.GetType()} doesn't render a page as root");
            }
        }
        private void OnComponentAssemblyChanged(object sender, EventArgs e)
        {
            try
            {
                var newComponent = RxApplication.Instance.ComponentLoader.LoadComponent <T>();
                if (newComponent != null)
                {
                    _component = newComponent;

                    Invalidate();
                }
                else
                {
                    System.Diagnostics.Debug.WriteLine($"Unable to hot relead component {typeof(T).FullName}: type not found in received assembly");
                }
            }
            catch (Exception ex)
            {
                RxApplication.Instance.FireUnhandledExpectionEvent(ex);
            }
        }
        //private readonly VisualTree _visualTree;

        public RxHostElement(RxComponent rootComponent)
        {
            _rootComponent = rootComponent ?? throw new ArgumentNullException(nameof(rootComponent));
            //_visualTree = new VisualTree(this);
        }
 protected virtual RxComponent InitializeComponent(RxComponent component)
 {
     return(component);
 }