annotate Messaging/Common/Xaml/XamlHelper.cs @ 29:9919ee227c93

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