當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。