예제 #1
0
        public void Render(IUIContainer container)
        {
            _stackPanel = container.GetInterface<IStackPanel>();

            if (!_stackPanel.DisplaySummary)
            {
                if (_fileInfo.Extension == ".jpg")
                {
                    var image = new Image {Source = new BitmapImage(new Uri(_fileInfo.FullName))};
                    _stackPanel.AddChild(image);
                }
                else
                {
                    if (_bodyBlock.Parent != null)
                        ((StackPanel)_bodyBlock.Parent).Children.Remove(_bodyBlock);
                    _stackPanel.AddChild(_bodyBlock);
                }
            }
            else
            {
                if (_block.Parent != null)
                    ((StackPanel)_block.Parent).Children.Remove(_block);
                _stackPanel.AddChild(_block);
            }
        }
        public void Render(IUIContainer container)
        {
            _stackPanel = container.GetInterface<IStackPanel>();

            if (!_stackPanel.DisplaySummary)
            {
                if (_hasChildren == null) return;

                var scrollViewer = new ScrollViewer();
                var newStackPanel = new StackPanel();
                scrollViewer.Content = newStackPanel;
                scrollViewer.HorizontalScrollBarVisibility = ScrollBarVisibility.Auto;

                var newStackPanelWrapper = new StackPanelWrapper(newStackPanel, scrollViewer, true);

                foreach (var child in _hasChildren.UIElements)
                {
                    if (child == null) continue;

                    child.Render(newStackPanelWrapper);
                }

                _stackPanel.AddChild(scrollViewer);

                var grid = (Grid) ((StackPanel) scrollViewer.Parent).Parent;
                var parent = (Window)grid.Parent;
                parent.SizeChanged += ParentSizeChanged;
            }
            else
            {
                if (_block.Parent != null)
                    ((StackPanel)_block.Parent).Children.Remove(_block);
                _stackPanel.AddChild(_block);
            }
        }
        public void Render(IUIContainer container)
        {
            _stackPanel = container.GetInterface<IStackPanel>();
            var block = _stackPanel.DisplaySummary ? _summaryBlock : _bodyBlock;

            if (block.Parent != null)
                ((StackPanel)block.Parent).Children.Remove(block);
            _stackPanel.AddChild(block);
        }