示例#1
0
        public StreamItemViewModel(StreamItemModel model)
        {
            _model = model;
            _model.PropertyChanged += Model_PropertyChanged;

            _storyBoard.Children.Add(_animationX);
            _storyBoard.Children.Add(_animationY);
            _storyBoard.Duration = _duration;

            _animationX.Duration = _duration;
            _animationY.Duration = _duration;

            Storyboard.SetTarget(_animationX, _projection);
            Storyboard.SetTarget(_animationY, _projection);

            Storyboard.SetTargetProperty(_animationX, new PropertyPath("RotationX"));
            Storyboard.SetTargetProperty(_animationY, new PropertyPath("RotationY"));

            RequestedSize = Size.None;
        }
        public StreamItemViewModel(StreamItemModel model)
        {
            _model = model;
            _model.PropertyChanged += Model_PropertyChanged;

            _storyBoard.Children.Add(_animationX);
            _storyBoard.Children.Add(_animationY);
            _storyBoard.Duration = _duration;

            _animationX.Duration = _duration;
            _animationY.Duration = _duration;

            Storyboard.SetTarget(_animationX, _projection);
            Storyboard.SetTarget(_animationY, _projection);

            Storyboard.SetTargetProperty(_animationX, new PropertyPath("RotationX"));
            Storyboard.SetTargetProperty(_animationY, new PropertyPath("RotationY"));

            RequestedSize = Size.None;
        }
        private void AddItemToViewModel(StreamItemModel item)
        {
            if (_currentMosaicViewModel == null || _currentMosaicViewModel.Count == PhotoMosaicViewModel.MaxItems)
            {
                _currentMosaicViewModel = new PhotoMosaicViewModel()
                {
                    StreamItemTapped = PhotoMosaicViewModel_PhotoStreamItemTapped
                };

                ListBoxItems.Add(_currentMosaicViewModel);
            }

            StreamItemViewModel m = new StreamItemViewModel(item);
            //m.Render(StreamItemViewModel.Size.Small); // pre-render

            _currentMosaicViewModel.Add(m);
        }