当前位置: 首页>>代码示例>>C#>>正文


C# Controls.ScrollViewer类代码示例

本文整理汇总了C#中System.Windows.Controls.ScrollViewer的典型用法代码示例。如果您正苦于以下问题:C# ScrollViewer类的具体用法?C# ScrollViewer怎么用?C# ScrollViewer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ScrollViewer类属于System.Windows.Controls命名空间,在下文中一共展示了ScrollViewer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Comment

        public Comment(Node hostNode)
        {
            HostNode = hostNode;

            var scrollViewer = new ScrollViewer
            {
                HorizontalScrollBarVisibility = ScrollBarVisibility.Disabled,
                VerticalScrollBarVisibility = ScrollBarVisibility.Visible,
                Height = 70,
                CanContentScroll = true
            };

            var textBlock = new TextBlock
            {
                Background = Brushes.Transparent,
                TextWrapping = TextWrapping.Wrap,
                Margin = new Thickness(5),
                FontSize = 12
            };

            Child = scrollViewer;
            CornerRadius = new CornerRadius(5);
            scrollViewer.Content = textBlock;


            var bindingTextToTextBlock = new Binding("Text")
            {
                Source = this,
                Mode = BindingMode.OneWay
            };
            textBlock.SetBinding(TextBlock.TextProperty, bindingTextToTextBlock);

            hostNode.SpaceCanvas.Children.Add(this);
        }
开发者ID:bsudhakarGit,项目名称:TUM.CMS.VPLControl,代码行数:34,代码来源:Comment.cs

示例2: HorizontalMouseScrollHelper

 public HorizontalMouseScrollHelper(ScrollViewer scrollviewer, DependencyObject d)
 {
     scrollViewer = scrollviewer;
     source = (HwndSource)PresentationSource.FromDependencyObject(d);
     if (source != null)
         source.AddHook(WindowProc);
 }
开发者ID:jayhill,项目名称:FluentFilters,代码行数:7,代码来源:HorizontalMouseScrollHelper.cs

示例3: ExamineKeystrokes

        public ExamineKeystrokes()
        {
            Title = "Examine Keystrokes";
            FontFamily = new FontFamily("Courier New");

            Grid grid = new Grid();
            Content = grid;

            // Make one row "auto" and the other fill the remaining space.
            RowDefinition rowdef = new RowDefinition();
            rowdef.Height = GridLength.Auto;
            grid.RowDefinitions.Add(rowdef);
            grid.RowDefinitions.Add(new RowDefinition());

            // Display header text.
            TextBlock textHeader = new TextBlock();
            textHeader.FontWeight = FontWeights.Bold;
            textHeader.Text = strHeader;
            grid.Children.Add(textHeader);

            // Create StackPanel as child of ScrollViewer for displaying events.
            scroll = new ScrollViewer();
            grid.Children.Add(scroll);
            Grid.SetRow(scroll, 1);

            stack = new StackPanel();
            scroll.Content = stack;
        }
开发者ID:gawallsibya,项目名称:BIT_MFC-CShap-DotNet,代码行数:28,代码来源:ExamineKeystrokes.cs

示例4: PageCalendar

        public PageCalendar()
        {
            InitializeComponent();

            this.Uid = "1000";
            this.Title = Translator.GetInstance().GetString("PageCalendar", this.Uid);

            StackPanel calendarPanel = new StackPanel();
            calendarPanel.Margin = new Thickness(10, 0, 10, 0);

            cbShowAll = new CheckBox();
            cbShowAll.Content = Translator.GetInstance().GetString("PageCalendar","200");
            cbShowAll.FlowDirection = System.Windows.FlowDirection.RightToLeft;
            cbShowAll.Checked += new RoutedEventHandler(cbShowAll_Checked);
            cbShowAll.Unchecked += new RoutedEventHandler(cbShowAll_Unchecked);
            cbShowAll.HorizontalAlignment = System.Windows.HorizontalAlignment.Left;
            cbShowAll.IsChecked = false;

            calendarPanel.Children.Add(cbShowAll);

            ScrollViewer viewer = new ScrollViewer();
            viewer.MaxHeight = GraphicsHelpers.GetContentHeight() - 50;

            ucCalendar = new ucCalendar();

            viewer.Content = ucCalendar;

            calendarPanel.Children.Add(viewer);

            base.setContent(calendarPanel);

            base.setHeaderContent(this.Title);

            showPage(this);
        }
开发者ID:rhgtvcx,项目名称:tap-desktop,代码行数:35,代码来源:PageCalendar.xaml.cs

示例5: DocumentViewLoaded

        private void DocumentViewLoaded(object sender, RoutedEventArgs e)
        {
            using (var stream = Assembly.GetEntryAssembly().GetManifestResourceStream("MarkPad.Syntax.Markdown.xshd"))
            using (var reader = new XmlTextReader(stream))
            {
                Editor.SyntaxHighlighting = HighlightingLoader.Load(reader, HighlightingManager.Instance);
            }

            documentScrollViewer = Editor.FindVisualChild<ScrollViewer>();

            if (documentScrollViewer != null)
            {
                documentScrollViewer.ScrollChanged += (i, j) => wb.ExecuteJavascript("window.scrollTo(0," + j.VerticalOffset + ");");
                var x = ((DocumentViewModel)DataContext);
                x.Document.TextChanged += (i, j) =>
                                              {
                                                  wb.LoadCompleted += (k, l) => wb.ExecuteJavascript("window.scrollTo(0," + documentScrollViewer.VerticalOffset + ");");
                                              };
            }

            //  AvalonEdit hijacks Ctrl+I. We need to free that mutha up
            var editCommandBindings = Editor.TextArea.DefaultInputHandler.Editing.CommandBindings;

            editCommandBindings
                .FirstOrDefault(b => b.Command == ICSharpCode.AvalonEdit.AvalonEditCommands.IndentSelection)
                .ExecuteSafely(b => editCommandBindings.Remove(b));
        }
开发者ID:jakubl,项目名称:DownmarkerWPF,代码行数:27,代码来源:DocumentView.xaml.cs

示例6: ScrollAdjustmentBackend

 public ScrollAdjustmentBackend(ScrollViewer s, bool isVertical)
 {
     TargetScrollViewer = s;
     this.isVertical = isVertical;
     scrollValue = 0;
     lowerValue = 0;
 }
开发者ID:nbros,项目名称:xwt,代码行数:7,代码来源:ScrollAdjustmentBackend.cs

示例7: WatchNode

        public WatchNode(Core.VplControl hostCanvas) : base(hostCanvas)
        {
            AddInputPortToNode("Object", typeof (object));

            var textBlock = new TextBlock
            {
                TextWrapping = TextWrapping.Wrap,
                FontSize = 14,
                Padding = new Thickness(5),
                IsHitTestVisible = false
            };

            var scrollViewer = new ScrollViewer
            {
                HorizontalScrollBarVisibility = ScrollBarVisibility.Auto,
                VerticalScrollBarVisibility = ScrollBarVisibility.Auto,
                MinWidth = 120,
                MinHeight = 20,
                MaxWidth = 200,
                MaxHeight = 400,
                CanContentScroll = true,
                Content = textBlock
                //IsHitTestVisible = false
            };


            AddControlToNode(scrollViewer);
        }
开发者ID:bsudhakarGit,项目名称:TUM.CMS.VPLControl,代码行数:28,代码来源:WatchNode.cs

示例8: ScrollControlBackend

 public ScrollControlBackend(ScrollViewer s, bool isVertical)
 {
     targetScrollViewer = s;
     this.isVertical = isVertical;
     scrollValue = Value;
     targetScrollViewer.ScrollChanged += HandleScrollChanged;
 }
开发者ID:nbros,项目名称:xwt,代码行数:7,代码来源:ScrollControlBackend.cs

示例9: SyntaxHighlightBox

        // --------------------------------------------------------------------
        // Ctor and event handlers
        // --------------------------------------------------------------------
        public SyntaxHighlightBox()
        {
            InitializeComponent();

            MaxLineCountInBlock = 100;
            LineHeight = FontSize * 1.3;
            totalLineCount = 1;
            blocks = new List<InnerTextBlock>();

            Loaded += (s, e) => {
                renderCanvas = (DrawingControl)Template.FindName("PART_RenderCanvas", this);
                scrollViewer = (ScrollViewer)Template.FindName("PART_ContentHost", this);

                scrollViewer.ScrollChanged += OnScrollChanged;

                InvalidateBlocks(0);
                InvalidateVisual();
            };

            SizeChanged += (s, e) => {
                if (e.HeightChanged == false)
                    return;
                UpdateBlocks();
                InvalidateVisual();
            };

            TextChanged += (s, e) => {
                UpdateTotalLineCount();
                InvalidateBlocks(e.Changes.First().Offset);
                InvalidateVisual();
            };
        }
开发者ID:YxCREATURExY,项目名称:Assembly,代码行数:35,代码来源:SyntaxHighlightBox.xaml.cs

示例10: OnApplyTemplate

 public override void OnApplyTemplate()
 {
     base.OnApplyTemplate();
     ParamContainer = GetTemplateChild(PART_ParamContainer) as Grid;
     paramsScroller = GetTemplateChild(PART_ParamsScroller) as ScrollViewer;
     BuildUI();
 }
开发者ID:Esri,项目名称:arcgis-viewer-silverlight,代码行数:7,代码来源:GPWidget.cs

示例11: WpfPropertyPage_Load

        private void WpfPropertyPage_Load(object sender, EventArgs e) {
            SuspendLayout();

            _host = new PropertyPageElementHost();
            _host.AutoSize = false;
            _host.Dock = DockStyle.Fill;

            if (_control == null) {
                _control = CreatePropertyPageControl();
            }

            ScrollViewer viewer = new ScrollViewer {
                VerticalScrollBarVisibility = ScrollBarVisibility.Auto,
                HorizontalScrollBarVisibility = ScrollBarVisibility.Auto
            };

            viewer.Content = _control;
            _host.Child = viewer;

            wpfHostPanel.Dock = DockStyle.Fill;
            wpfHostPanel.Controls.Add(_host);

            ResumeLayout(true);
            _control.StatusChanged += _control_OnControlStatusChanged;
        }
开发者ID:Microsoft,项目名称:RTVS,代码行数:25,代码来源:WpfBasedPropertyPage.cs

示例12: InternalOptionsControl

        public InternalOptionsControl(string featureOptionName, IServiceProvider serviceProvider)
            : base(serviceProvider)
        {
            _featureOptionName = featureOptionName;

            var panel = new StackPanel();
            this.AddOptions(panel);

            var viewer = new ScrollViewer();
            viewer.VerticalScrollBarVisibility = ScrollBarVisibility.Auto;
            viewer.HorizontalScrollBarVisibility = ScrollBarVisibility.Auto;

            var checkAllButton = new Button() { Content = "Check All" };
            checkAllButton.Click += (o, a) => panel.Children.OfType<CheckBox>().Do(c => c.IsChecked = true);

            var uncheckAllButton = new Button() { Content = "Uncheck All" };
            uncheckAllButton.Click += (o, a) => panel.Children.OfType<CheckBox>().Do(c => c.IsChecked = false);

            var selectionPanel = new StackPanel();
            selectionPanel.Children.Add(checkAllButton);
            selectionPanel.Children.Add(uncheckAllButton);

            panel.Children.Add(selectionPanel);

            viewer.Content = panel;

            this.Content = viewer;
        }
开发者ID:XieShuquan,项目名称:roslyn,代码行数:28,代码来源:InternalOptionsControl.cs

示例13: Render

        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);
            }
        }
开发者ID:mcwatt77,项目名称:vimcontrols,代码行数:35,代码来源:StringWithChildrenElement.cs

示例14: ClosableTabItem

 public ClosableTabItem(string title, FrameworkElement image)
 {
     CloseableHeader closableTabHeader = new CloseableHeader();
     closableTabHeader.FileName.Content = title;
     closableTabHeader.close_button.Click += new System.Windows.RoutedEventHandler(close_button_Click);
     this.Header = closableTabHeader;
     ScrollViewer sv = new ScrollViewer();
     sv.HorizontalScrollBarVisibility = ScrollBarVisibility.Visible;
     sv.Loaded += new RoutedEventHandler(sv_Loaded);
     Canvas svContent = new Canvas();
     svContent.Background = Brushes.DarkGray;
     //svContent.MouseWheel += new MouseWheelEventHandler(sv_MouseWheel);
     sv.Content = svContent;
     Canvas viewPort = new Canvas();
     viewPort.Background = Brushes.White;
     viewPort.ClipToBounds = true;
     viewPort.MouseDown += new MouseButtonEventHandler(SelectItem);
     viewPort.LayoutTransform = newTransformations();
     viewPort.Children.Add(image);
     Canvas.SetTop(image, 0);
     Canvas.SetLeft(image, 0);
     image.Loaded += new RoutedEventHandler(image_Loaded);
     svContent.Children.Add(viewPort);
     this.Content = sv;
 }
开发者ID:xtremas,项目名称:final-bachelor-project,代码行数:25,代码来源:ClosableTabItem.cs

示例15: SettingItemCanvas

		public SettingItemCanvas()
		{
			InitializeComponent();

			mItemrList = new List<Item>();

			canvas.Width = SettingItemButton.WIDTH;
			canvas.Height = SettingItemButton.HEIGHT * 7;
			canvas.Background = MetrialColor.getBrush(MetrialColor.Name.LightBlue, 0);
			setHeader();

			mSettingItemButtonScrollViewer = new ScrollViewer();
			mSettingItemButtonScrollViewer.VerticalScrollBarVisibility = ScrollBarVisibility.Auto;
			mSettingItemButtonScrollViewer.Width = SettingItemButton.WIDTH;
			mSettingItemButtonScrollViewer.Height = SettingItemButton.HEIGHT * 14;
			Canvas.SetTop(mSettingItemButtonScrollViewer, 100);
			Canvas.SetLeft(mSettingItemButtonScrollViewer, 50);
			canvas.Children.Add(mSettingItemButtonScrollViewer);

			mSettingItemButtonStackPanel = new StackPanel();
			mSettingItemButtonStackPanel.Orientation = Orientation.Vertical;
			mSettingItemButtonStackPanel.HorizontalAlignment = System.Windows.HorizontalAlignment.Left;
			Canvas.SetTop(mSettingItemButtonStackPanel, 0);
			Canvas.SetLeft(mSettingItemButtonStackPanel, 0);
			mSettingItemButtonScrollViewer.Content = mSettingItemButtonStackPanel;
			mSettingItemButtonStackPanel.Background = MetrialColor.getBrush(MetrialColor.Name.LightBlue, 0);

			updateSettingItemButton();
		}
开发者ID:jelee9,项目名称:wsr_pos_vs,代码行数:29,代码来源:SettingItemCanvas.xaml.cs


注:本文中的System.Windows.Controls.ScrollViewer类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。