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


C# ScrollViewer.SetValue方法代码示例

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


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

示例1: SetAutoScrollToEnd

 public static void SetAutoScrollToEnd(ScrollViewer instance, bool value) {
     var oldHandler = (ScrollViewerAutoScrollToEndHandler) instance.GetValue(AutoScrollHandlerProperty);
     if (oldHandler != null) {
         oldHandler.Dispose();
         instance.SetValue(AutoScrollHandlerProperty, null);
     }
     instance.SetValue(AutoScrollProperty, value);
     if (value)
         instance.SetValue(AutoScrollHandlerProperty, new ScrollViewerAutoScrollToEndHandler(instance));
 }
开发者ID:MaHuJa,项目名称:withSIX.Desktop,代码行数:10,代码来源:ScrollviewerAutoScroll.cs

示例2: SetAlwaysScrollToEnd

        public static void SetAlwaysScrollToEnd(ScrollViewer scroll, bool alwaysScrollToEnd) {
            if (scroll == null) {
                throw new ArgumentNullException("scroll");
            }

            scroll.SetValue(AlwaysScrollToEndProperty, alwaysScrollToEnd);
        }
开发者ID:mmalek06,项目名称:FunkyCodeEditor,代码行数:7,代码来源:Autoscroll.cs

示例3: ScrollViewer

        public void ScrollViewer(ScrollViewer control)
        {
            control.Width = 300;
            control.Height = 200;

            var placeholder = new Placeholder { Height = 500 };
            control.Content = placeholder;
            control.SetValue(Behaviors.MouseWheelScrollerProperty, new MouseWheelScroller());
        }
开发者ID:philcockfield,项目名称:Open.TestHarness.SL,代码行数:9,代码来源:MouseWheelScroller.ViewTest.cs

示例4: OtherAction

        private void OtherAction(DataResult result)
        {
            isSelect = false;
            this.selectDataresult = result;
            NextStateCode = result.AppState;

            System.Windows.Controls.Window winSelector = new System.Windows.Controls.Window();
            winSelector.Unloaded += new RoutedEventHandler(winSelector_Unloaded);
            winSelector.Height = 250;
            winSelector.Width = 400;
            winSelector.TitleContent = "确认审核人";
            Grid gridSelector = new Grid();
            RowDefinition r1 = new RowDefinition();
            RowDefinition r2 = new RowDefinition();
            RowDefinition r3 = new RowDefinition();
            r1.Height = new GridLength(20, GridUnitType.Auto);
            r2.Height = new GridLength(1, GridUnitType.Star);
            r3.Height = new GridLength(20, GridUnitType.Auto);
            gridSelector.RowDefinitions.Add(r1);
            gridSelector.RowDefinitions.Add(r2);
            gridSelector.RowDefinitions.Add(r3);


            TextBlock tb = new TextBlock();
            tb.Text = "不能确定下一审核人, 请重新选择一个审核人,并按确认提交";
            tb.SetValue(Grid.RowProperty, 0);

            ScrollViewer scrollp = new ScrollViewer();
            scrollp.SetValue(Grid.RowProperty, 1);

            StackPanel sp = new StackPanel();            
            sp.Margin = new Thickness(15, 5, 0, 0);
            sp.Orientation = Orientation.Vertical;
          

            for (int i = 0; i < result.UserInfo.Count; i++)
            {
                RadioButton rbtn = new RadioButton();
                //rbtn.Content = result.UserInfo[i].UserName;
                rbtn.Content = result.UserInfo[i].UserName + "(" + result.UserInfo[i].CompanyName + "->" + result.UserInfo[i].DepartmentName + "->" + result.UserInfo[i].PostName + ")";

                rbtn.DataContext = result.UserInfo[i];
                rbtn.GroupName = "User";
                sp.Children.Add(rbtn);
            }
            scrollp.Content = sp;

            Button btnOK = new Button();
            btnOK.Height = 26;
            btnOK.Width = 80;
            btnOK.Content = Utility.GetResourceStr("lblConfirm");
            btnOK.HorizontalAlignment = HorizontalAlignment.Right;
            btnOK.Margin = new Thickness(0, 0, 5, 10);
            btnOK.SetValue(Grid.RowProperty, 2);

            btnOK.Click += (e, o) =>
            {
                this.isSelect = true;
                UIElement element = sp.Children.FirstOrDefault(item =>
                {
                    RadioButton rb = item as RadioButton;
                    return rb.IsChecked == true;
                });
                if (element == null)
                {
                    this.isSelect = false;
                    ComfirmWindow.ConfirmationBox("警告", "请先选择一个审核人!", Utility.GetResourceStr("CONFIRMBUTTON"));

                    //MessageBox.Show("请先选择一个审核人");
                }
                else
                {
                    RadioButton rbSelect = element as RadioButton;
                    UserInfo otherUser = rbSelect.DataContext as UserInfo;
                    NextCompanyID = otherUser.CompanyID;
                    NextDepartmentID = otherUser.DepartmentID;
                    NextPostID = otherUser.PostID;
                    NextUserID = otherUser.UserID;
                    NextUserName = otherUser.UserName;

                    InnerHandIn(currAuditOperation, curAuditAction);
                    winSelector.Close();
                }
            };
            ContentControl parent = new ContentControl();
            parent.Content = gridSelector;

            winSelector.Content = parent;
            gridSelector.Children.Add(tb);
            gridSelector.Children.Add(scrollp);
            gridSelector.Children.Add(btnOK);
            FrameworkElement fe = SMT.SAAS.Main.CurrentContext.Common.ParentLayoutRoot;

            // Window.Show("", "", Guid.NewGuid().ToString(), true, false, parent, null);
            winSelector.Show<string>(DialogMode.Default, fe, "", (resulta) => { });

        }
开发者ID:fuhongliang,项目名称:oa,代码行数:97,代码来源:AuditControl.xaml.cs

示例5: CounterAction

        private void CounterAction(DataResult result)
        {
            this.isSelect = false;
            this.selectDataresult = result;
            NextStateCode = result.AppState;
            List<Rule_UserInfoViewModel> listviewmodel = new List<Rule_UserInfoViewModel>();
            result.DictCounterUser.Keys.ForEach(key =>
            {
                Rule_UserInfoViewModel vm = new Rule_UserInfoViewModel(key, result.DictCounterUser[key].ToList());
                listviewmodel.Add(vm);
            });
            //this.ListCountersign.ItemsSource = listviewmodel;
            //AuditEventArgs args = new AuditEventArgs(AuditEventArgs.AuditResult.Error, result);
            //args.StartDate = this.AuditEntity.StartDate;
            //args.EndDate = System.DateTime.Now;
            //OnAuditCompleted(this, args);
            //this.BindingData();
            DataTemplate CountersignTemplate = this.Resources["CountersignTemplate"] as DataTemplate;
            Style listboxStyle = this.Resources["ListBoxItemStyle1"] as Style;
            System.Windows.Controls.Window winSelector = new System.Windows.Controls.Window();
            winSelector.Unloaded += new RoutedEventHandler(winSelector_Unloaded);
            winSelector.MinHeight = 400;
            winSelector.Width = 400;
            //winSelector.Resources.Add("UserInfoTemplate", this.Resources["UserInfoTemplate"]);
            //winSelector.Resources.Add("ListBoxItemStyle1", this.Resources["ListBoxItemStyle1"]);
            //winSelector.Resources.Add("CountersignTemplate", this.Resources["CountersignTemplate"]);

            //winSelector.Width = 400;
            winSelector.TitleContent = "确认审核人";

            Grid gridSelector = new Grid();
            RowDefinition r1 = new RowDefinition();
            RowDefinition r2 = new RowDefinition();
            RowDefinition r3 = new RowDefinition();


            r1.Height = new GridLength(50, GridUnitType.Auto);
            r2.Height = new GridLength(30, GridUnitType.Auto);
            r3.Height = new GridLength(50, GridUnitType.Auto);
            gridSelector.RowDefinitions.Add(r1);
            gridSelector.RowDefinitions.Add(r2);
            gridSelector.RowDefinitions.Add(r3);
            TextBlock tb = new TextBlock();
            tb.Height = 26;
            tb.VerticalAlignment = System.Windows.VerticalAlignment.Center;
            if (result.CountersignType == "0")
            {
                tb.Text = "请为每个角色至少选择一人,并按确认提交。";
            }
            else
            {
                tb.Text = "请至少选择一人,并按确认提交。";
            }
            tb.SetValue(Grid.RowProperty, 0);

            ScrollViewer sp = new ScrollViewer();
            ListBox listboxCountersign = new ListBox();

            listboxCountersign.ItemTemplate = CountersignTemplate;
            listboxCountersign.ItemContainerStyle = listboxStyle;
            listboxCountersign.HorizontalContentAlignment = System.Windows.HorizontalAlignment.Stretch;
            listboxCountersign.VerticalAlignment = System.Windows.VerticalAlignment.Top;
            sp.SetValue(Grid.RowProperty, 1);
            listviewmodel.ForEach(item =>
            {
                item.ListUserInfo.ForEach(ent =>
                {
                    ent.UserInfo.CompanyName = ent.UserInfo.UserName + "(" + ent.UserInfo.CompanyName + "->" + ent.UserInfo.DepartmentName + "->" + ent.UserInfo.PostName + ")";

                });
            });
            listboxCountersign.ItemsSource = listviewmodel;

            sp.Height = 300;
            sp.Width = 400;
            //listboxCountersign.
          //listboxCountersign.ScrollIntoView(listviewmodel);
          listboxCountersign.UpdateLayout();
          sp.Content=listboxCountersign;

            Button btnOK = new Button();
            btnOK.Content = "确认";
            btnOK.Margin = new Thickness(0, 0, 5, 10);
            btnOK.VerticalAlignment = System.Windows.VerticalAlignment.Center;
            btnOK.HorizontalAlignment = System.Windows.HorizontalAlignment.Right;
            btnOK.Width = 80;
            btnOK.Height = 26;
            btnOK.SetValue(Grid.RowProperty, 2);

            btnOK.Click += (o, e) =>
            {
                this.isSelect = true;
                #region

                #region Check
                this.DictCounterUser = new Dictionary<Role_UserType, ObservableCollection<UserInfo>>();
                if (result.CountersignType == "0")
                {
                    foreach (var viewModel in listviewmodel)
                    {
//.........这里部分代码省略.........
开发者ID:fuhongliang,项目名称:oa,代码行数:101,代码来源:AuditControl.xaml.cs

示例6: TestWindow

            public TestWindow(Program.Logger _logger)
            {
                StackPanel sp1 = null;
                StackPanel sp2 = null;

                EventHandler<Program.LogData> _LoggerLogAdded = (sender, e) => ((Action)(() =>
                {
                    TextBlock tb = new TextBlock();
                    tb.Text = e.Text;
                    tb.Foreground = e.Kind == Program.LogData.LogKind.error ? Brushes.Red : Brushes.White;
                    tb.Margin = new Thickness(0.0, 10.0, 0.0, 10.0);

                    sp2.Children.Add(tb);
                })).BeginExecuteInUIThread();

                Loaded += (sender, e) =>
                {
                    Grid grid = new Grid();
                    grid.RowDefinitions.Add(new RowDefinition());
                    grid.RowDefinitions.Add(new RowDefinition());
                    grid.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
                    grid.ColumnDefinitions.Add(new ColumnDefinition());

                    ScrollViewer sv1 = new ScrollViewer();
                    sv1.VerticalScrollBarVisibility = ScrollBarVisibility.Auto;
                    sv1.HorizontalScrollBarVisibility = ScrollBarVisibility.Auto;
                    sv1.SetValue(Grid.RowProperty, 0);
                    sv1.SetValue(Grid.ColumnProperty, 0);

                    sp1 = new StackPanel();
                    sp1.Background = Brushes.Black;

                    ScrollViewer sv2 = new ScrollViewer();
                    sv2.VerticalScrollBarVisibility = ScrollBarVisibility.Auto;
                    sv2.HorizontalScrollBarVisibility = ScrollBarVisibility.Auto;
                    sv2.SetValue(Grid.RowProperty, 1);
                    sv2.SetValue(Grid.ColumnProperty, 0);

                    sp2 = new StackPanel();
                    sp2.Background = Brushes.Black;

                    sv1.Content = sp1;
                    sv2.Content = sp2;

                    TextBox tb = new TextBox();
                    tb.SetValue(Grid.RowProperty, 2);
                    tb.SetValue(Grid.ColumnProperty, 0);

                    grid.Children.Add(sv1);
                    grid.Children.Add(sv2);
                    grid.Children.Add(tb);

                    Content = grid;

                    Console.SetOut(new TextBlockStreamWriter(sp1));

                    _logger.LogAdded += _LoggerLogAdded;

                    //SimulationWindow sw = new SimulationWindow();
                    //sw.ShowDialog();

                    this.StartTask(string.Empty, string.Empty, () =>
                    {


                        //string testPrivateRsaParameters;
                        //using (RSACryptoServiceProvider rsacsp = new RSACryptoServiceProvider(2048))
                        //    testPrivateRsaParameters = rsacsp.ToXmlString(true);


                        //RealInboundChennel ric = new RealInboundChennel(7777, RsaKeySize.rsa2048, 100);
                        //ric.Accepted += (sender2, e2) =>
                        //{
                        //    this.StartTask("", "", () =>
                        //    {
                        //        e2.WriteBytes(BitConverter.GetBytes(true));

                        //        bool b = BitConverter.ToBoolean(e2.ReadBytes(), 0);

                        //        SessionChannel sc = e2.NewSession();
                        //        sc.WriteBytes(BitConverter.GetBytes(true));
                        //        sc.Close();

                        //        //e2.Close();
                        //    });


                        //    //e2.Close();

                        //    //Console.WriteLine("");
                        //};
                        //ric.RequestAcceptanceStart();


                        //AutoResetEvent are = new AutoResetEvent(false);
                        //SocketChannel socketc = null;

                        //RealOutboundChannel roc = new RealOutboundChannel(IPAddress.Loopback, 7777, RsaKeySize.rsa2048, testPrivateRsaParameters);
                        //roc.Connected += (sender2, e2) =>
                        //{
//.........这里部分代码省略.........
开发者ID:pizyumi,项目名称:CREA,代码行数:101,代码来源:Core.cs

示例7: SetMouseWheelScroller

 public static void SetMouseWheelScroller(ScrollViewer element, MouseWheelScroller value) { element.SetValue(MouseWheelScrollerProperty, value); }
开发者ID:philcockfield,项目名称:Open.TestHarness.SL,代码行数:1,代码来源:Behaviors.cs

示例8: SetAutoScrollToEndOnPropertyOrCollectionChanged

 public static void SetAutoScrollToEndOnPropertyOrCollectionChanged(ScrollViewer element, object value)
 {
     element.SetValue(AutoScrollToEndOnPropertyOrCollectionChangedProperty, value);
 }
开发者ID:masonyang,项目名称:OptiKey,代码行数:4,代码来源:ScrollViewerBehaviours.cs

示例9: SetVerticalScrollBarOnLeftSide

 public static void SetVerticalScrollBarOnLeftSide(ScrollViewer obj, bool value)
 {
     obj.SetValue(VerticalScrollBarOnLeftSideProperty, value);
 }
开发者ID:gjhwssg,项目名称:MahApps.Metro,代码行数:4,代码来源:ScrollBarHelper.cs

示例10: SetStoredFixedTransform

 internal static void SetStoredFixedTransform( ScrollViewer obj, Transform value )
 {
   obj.SetValue( TableViewScrollViewer.StoredFixedTransformPropertyKey, value );
 }
开发者ID:wangws556,项目名称:duoduo-chat,代码行数:4,代码来源:TableViewScrollViewer.cs

示例11: SetPreventViewUpdate

		public static void SetPreventViewUpdate(ScrollViewer scrollViewer, bool preventViewUpdate)
		{
			scrollViewer.SetValue(PreventViewUpdateProperty, preventViewUpdate);
		}
开发者ID:justdude,项目名称:DbExport,代码行数:4,代码来源:ControlBehavior.cs

示例12: SetHorizontalOffset

 private static void SetHorizontalOffset(ScrollViewer element, double value)
 {
     if (element == null)
     {
         throw new ArgumentNullException("element");
     }
     element.SetValue(HorizontalOffsetProperty, value);
 }
开发者ID:shijiaxing,项目名称:SilverlightToolkit,代码行数:8,代码来源:ScrollViewerExtensions.cs

示例13: GetScrollBarsForScrollViewer

    /// <summary>
    /// Attempts to extract the scrollbars that are within the scrollviewers
    /// visual tree. When extracted, event handlers are added to their ValueChanged events.
    /// </summary>
    private static void GetScrollBarsForScrollViewer(ScrollViewer scrollViewer)
    {
      ScrollBar scroll = GetScrollBar(scrollViewer, Orientation.Vertical);
      if (scroll != null)
      {
        // save a reference to this scrollbar on the attached property
        scrollViewer.SetValue(VerticalScrollBarProperty, scroll);

        // scroll the scrollviewer
        scrollViewer.ScrollToVerticalOffset(GetVerticalOffset(scrollViewer));

        // handle the changed event to update the exposed VerticalOffset
        scroll.ValueChanged += (s, e) => SetVerticalOffset(scrollViewer, e.NewValue);
      }

      scroll = GetScrollBar(scrollViewer, Orientation.Horizontal);
      if (scroll != null)
      {
        // save a reference to this scrollbar on the attached property
        scrollViewer.SetValue(HorizontalScrollBarProperty, scroll);

        // scroll the scrollviewer
        scrollViewer.ScrollToHorizontalOffset(GetHorizontalOffset(scrollViewer));

        // handle the changed event to update the exposed HorizontalOffset
        scroll.ValueChanged += (s, e) => scrollViewer.SetValue(HorizontalOffsetProperty, e.NewValue);
      }
    }
开发者ID:T1Easyware,项目名称:Soheil,代码行数:32,代码来源:ScrollOffsetBinding.cs

示例14: TestWindow

            public TestWindow(Program.Logger _logger)
            {
                StackPanel sp1 = null;
                StackPanel sp2 = null;

                EventHandler<Program.LogData> _LoggerLogAdded = (sender, e) => ((Action)(() =>
                {
                    TextBlock tb = new TextBlock();
                    tb.Text = e.Text;
                    tb.Foreground = e.Kind == Program.LogData.LogKind.error ? System.Windows.Media.Brushes.Red : System.Windows.Media.Brushes.White;
                    tb.Margin = new Thickness(0.0, 10.0, 0.0, 10.0);

                    sp2.Children.Add(tb);
                })).BeginExecuteInUIThread();

                Loaded += (sender, e) =>
                {
                    Grid grid = new Grid();
                    grid.RowDefinitions.Add(new RowDefinition());
                    grid.RowDefinitions.Add(new RowDefinition());
                    grid.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
                    grid.ColumnDefinitions.Add(new ColumnDefinition());

                    ScrollViewer sv1 = new ScrollViewer();
                    sv1.VerticalScrollBarVisibility = ScrollBarVisibility.Auto;
                    sv1.HorizontalScrollBarVisibility = ScrollBarVisibility.Auto;
                    sv1.SetValue(Grid.RowProperty, 0);
                    sv1.SetValue(Grid.ColumnProperty, 0);

                    sp1 = new StackPanel();
                    sp1.Background = System.Windows.Media.Brushes.Black;

                    ScrollViewer sv2 = new ScrollViewer();
                    sv2.VerticalScrollBarVisibility = ScrollBarVisibility.Auto;
                    sv2.HorizontalScrollBarVisibility = ScrollBarVisibility.Auto;
                    sv2.SetValue(Grid.RowProperty, 1);
                    sv2.SetValue(Grid.ColumnProperty, 0);

                    sp2 = new StackPanel();
                    sp2.Background = System.Windows.Media.Brushes.Black;

                    sv1.Content = sp1;
                    sv2.Content = sp2;

                    grid.Children.Add(sv1);
                    grid.Children.Add(sv2);

                    Content = grid;

                    Console.SetOut(new TextBlockStreamWriter(sp1));

                    _logger.LogAdded += _LoggerLogAdded;
                };

                Closed += (sender, e) =>
                {
                    _logger.LogAdded -= _LoggerLogAdded;

                    string fileText = string.Empty;
                    foreach (var child in sp1.Children)
                        fileText += (child as TextBlock).Text + Environment.NewLine;

                    File.AppendAllText(Path.Combine(new FileInfo(Assembly.GetEntryAssembly().Location).DirectoryName, "LogTest.txt"), fileText);
                };
            }
开发者ID:pizyumi,项目名称:CREA,代码行数:65,代码来源:MainWindow.xaml.cs

示例15: SetVerticalOffset

 private static void SetVerticalOffset(ScrollViewer element, double value)
 {
     if (element == null)
         throw new ArgumentNullException("element");
     element.SetValue(ScrollViewerExtensions.VerticalOffsetProperty, (object)value);
 }
开发者ID:sulerzh,项目名称:chart,代码行数:6,代码来源:ScrollViewerExtensions.cs


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