annotate Messaging/Common/Xaml/XamlHelper.cs @ 85:4863009a2edf

renamed bugs to todo
author Steven Hollidge <stevenhollidge@hotmail.com>
date Tue, 24 Apr 2012 00:52:39 +0100
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 }