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


C# TextBox.ScrollToHorizontalOffset方法代码示例

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


在下文中一共展示了TextBox.ScrollToHorizontalOffset方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: SetupCustomUIElements

        public override void SetupCustomUIElements(dynNodeView view)
        {

            //add a button to the inputGrid on the dynElement
            var readFileButton = new DynamoNodeButton
            {
                HorizontalAlignment = HorizontalAlignment.Stretch,
                VerticalAlignment = VerticalAlignment.Top,
                Height = Configurations.PortHeightInPixels
            };

            readFileButton.Click += readFileButton_Click;
            readFileButton.Content = "Browse...";
            readFileButton.HorizontalAlignment = HorizontalAlignment.Stretch;
            readFileButton.VerticalAlignment = VerticalAlignment.Center;

            var tb = new TextBox();
            if (string.IsNullOrEmpty(Value))
                Value = "No file selected.";

            tb.HorizontalAlignment = HorizontalAlignment.Stretch;
            tb.VerticalAlignment = VerticalAlignment.Center;
            var backgroundBrush = new SolidColorBrush(System.Windows.Media.Color.FromArgb(0, 0, 0, 0));
            tb.Background = backgroundBrush;
            tb.BorderThickness = new Thickness(0);
            tb.IsReadOnly = true;
            tb.IsReadOnlyCaretVisible = false;
            tb.TextChanged += delegate { 
                tb.ScrollToHorizontalOffset(double.PositiveInfinity); 
                view.ViewModel.DynamoViewModel.ReturnFocusToSearch(); 
            };
            tb.Margin = new Thickness(0,5,0,5);

            var sp = new StackPanel();
            sp.Children.Add(readFileButton);
            sp.Children.Add(tb);
            view.inputGrid.Children.Add(sp);

            tb.DataContext = this;
            var bindingVal = new Binding("Value")
            {
                Mode = BindingMode.TwoWay,
                Converter = new FilePathDisplayConverter()
            };
            tb.SetBinding(TextBox.TextProperty, bindingVal);
        }
开发者ID:RobertiF,项目名称:Dynamo,代码行数:46,代码来源:File.cs


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