comparison Messaging/Common/Xaml/XamlHelper.cs @ 27:96fdf58e05b4

Server working with sockets and rabbitmq
author adminsh@apollo
date Wed, 21 Mar 2012 19:00:59 +0000
parents
children
comparison
equal deleted inserted replaced
26:045dac571339 27:96fdf58e05b4
1 using System.Windows;
2 using System.Windows.Controls;
3
4 namespace Common.Xaml
5 {
6 public static class XamlHelper
7 {
8 public static bool GetAutoScroll(DependencyObject obj)
9 {
10 return (bool) obj.GetValue(AutoScrollProperty);
11 }
12
13 public static void SetAutoScroll(DependencyObject obj, bool value)
14 {
15 obj.SetValue(AutoScrollProperty, value);
16 }
17
18 public static readonly DependencyProperty AutoScrollProperty =
19 DependencyProperty.RegisterAttached("AutoScroll",
20 typeof(bool),
21 typeof(XamlHelper),
22 new PropertyMetadata(false, AutoScrollPropertyChanged));
23
24 private static void AutoScrollPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
25 {
26 var scrollViewer = d as ScrollViewer;
27
28 if (scrollViewer != null && (bool)e.NewValue)
29 {
30 scrollViewer.ScrollToBottom();
31 }
32 }
33 }
34 }