Beispiel #1
0
        public void HideContent(object content)
        {
            OverlayContentControl occ = hostCanvas.Children.OfType <OverlayContentControl>().SingleOrDefault(o => o.Content == content);

            if (occ != null)
            {
                hostCanvas.Children.Remove(occ);
                occ.IsRendering = false;
            }
            HasChildren = hostCanvas.Children.Count > 0;
        }
Beispiel #2
0
        public OverlayContentControl ShowContent(object content, Rect placementRect, object contentTemplateKey = null)
        {
            OverlayContentControl existingOCC = hostCanvas.Children.OfType <OverlayContentControl>().SingleOrDefault(o => o.Content == content);

            if (existingOCC != null)
            {
                return(existingOCC);
            }
            OverlayContentControl occ = new OverlayContentControl();

            occ.ParentOverlay = this;
            occ.Content       = content;
            if (contentTemplateKey != null)
            {
                occ.SetResourceReference(OverlayContentControl.ContentTemplateProperty, contentTemplateKey);
            }
            hostCanvas.Children.Add(occ);
            occ.TargetRect  = placementRect;
            HasChildren     = true;
            occ.IsRendering = true;
            return(occ);
        }