Interaction logic for UserControl1.xaml
Inheritance: System.Windows.Controls.UserControl
示例#1
0
		public Minimap(Canvas overlay)
		{
			_minimapItems = new ObservableCollection<IMapMarker>();

			_root = new Canvas() { Height = 1200.5d };
			_window = overlay;
			_window.Children.Add(_root);
			_window.SizeChanged += (s, e) => UpdateSizeAndPosition();

			_root.Children.Add(_minimapControl = new MinimapControl { DataContext = this });

			UpdateSizeAndPosition();
		}
示例#2
0
        public Minimap(Canvas overlay)
        {
            _minimapItems = new ObservableCollection <IMapMarker>();

            _root = new Canvas()
            {
                Height = 1200.5d
            };
            _window = overlay;
            _window.Children.Add(_root);
            _window.SizeChanged += (s, e) => UpdateSizeAndPosition();

            _root.Children.Add(_minimapControl = new MinimapControl {
                DataContext = this
            });

            UpdateSizeAndPosition();
        }
        public Minimap(Canvas overlay)
        {
            if (overlay == null)
            {
                throw new ArgumentNullException(nameof(overlay));
            }

            _minimapItems = new ObservableCollection <IMapMarker>();

            _root = new Canvas()
            {
                Height = (int)(PresentationSource.FromVisual(overlay).CompositionTarget.TransformToDevice.M22 * 1200 + 0.5)
            };
            _window = overlay;
            _window.Children.Add(_root);
            _window.SizeChanged += (s, e) => UpdateSizeAndPosition();

            _root.Children.Add(_minimapControl = new MinimapControl {
                DataContext = this
            });

            UpdateSizeAndPosition();
        }