示例#1
0
        public InfoCardWindowControl(InfoCardHost container)
        {
            if (container == null)
            {
                throw new ArgumentNullException("container");
            }

            InfoCardHost = container;

            InfoCardHost.SetInfoCardWindow(this, this);

            Setup(container.Location);
        }
示例#2
0
        public InfoCardWindow(InfoCardHost container)
        {
            if (container == null)
            {
                throw new ArgumentNullException("container");
            }

            InfoCardHost.SetInfoCardWindow(this, this);

            WindowStyle        = WindowStyle.None;
            ResizeMode         = ResizeMode.NoResize;
            AllowsTransparency = true;
            Background         = Brushes.Transparent;
            Width         = 0;
            Height        = 0;
            SizeToContent = SizeToContent.WidthAndHeight;

            InfoCardHost = container;

            var ownerWindow = GetWindow(InfoCardSite);

            if (ownerWindow != null)
            {
                Owner = ownerWindow;
            }

            var infoCard = (InfoCard)container.Content;
            var location = container.Location ?? new Point(0, 0);

            _transformToDevice = Matrix.Identity;

            var targetWindow = GetWindow(infoCard.TargetElement);

            if (targetWindow != null)
            {
                _transformToDevice.OffsetX = targetWindow.Left;
                _transformToDevice.OffsetY = targetWindow.Top;
                location = _transformToDevice.Transform(location);
            }

            Setup(location);

            Loaded += OnLoaded;
        }