private static void OnChatBubbleDirectionChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { ChatBubbleTextBox sender = d as ChatBubbleTextBox; if (sender != null) { sender.UpdateChatBubbleDirection(); } }
public Chat() { InitializeComponent(); Specimen spec = PhenologyDataContext.Singleton().selected(); PageTitle.Text = spec.Id + " " + spec.Name; for (int date = 0; date < PhenologyDataContext.Singleton().Date; date++) { chat.Children.Add(new ChatBubble { Margin = new Thickness(12, 12, 12, 12), Background = App.Current.Resources["PhoneDisabledBrush"] as Brush, ChatBubbleDirection = ChatBubbleDirection.UpperLeft, Content = PhenoPrompt.phenoPanel(spec.Phenologies[date]) }); } int[] phenology = spec.getPhenology(); if (phenology.Sum() > 0) myBubble = new ChatBubble { Margin = new Thickness(12, 12, 12, 12), Background = App.Current.Resources["PhoneDisabledBrush"] as Brush, ChatBubbleDirection = ChatBubbleDirection.LowerRight, Content = PhenoPrompt.phenoPanel(phenology) }; myBubbleText = new ChatBubbleTextBox { AcceptsReturn = true, Margin = new Thickness(12, 12, 12, 12), VerticalAlignment = VerticalAlignment.Bottom, ChatBubbleDirection = ChatBubbleDirection.LowerRight, }; if (myBubble != null) chat.Children.Add(myBubble); chat.Children.Add(myBubbleText); myBubbleText.Focus(); }