public ListBoxItemText(string text)
        {
            Margin = new Thickness(10, 10, 10, 10);
            ColumnDefinitions.Add(new ColumnDefinition());
            RowDefinitions.Add(new RowDefinition());

            var bubble = new ChatBubble();
            SetColumn(bubble, 0);
            SetRow(bubble, 0);
            Children.Add(bubble);

            var spExternal = new StackPanel();
            bubble.Content = spExternal;

            m_text = new TextBlock {Text = text};
            SetColumn(m_text, 0);
            SetRow(m_text, 0);
            spExternal.Children.Add(m_text);

            var txt = new TextBlock
                {
                    HorizontalAlignment = HorizontalAlignment.Right,
                    TextAlignment = TextAlignment.Right,
                    MaxWidth = 400,
                    MinWidth = 300,
                    Style = (Style) Resources["PhoneTextSubtleStyle"],
                    FontSize = 15,
                    Margin = new Thickness(20, 0, 0, 0),
                    Text = DateTime.Now.ToShortTimeString(),
                };
            spExternal.Children.Add(txt);
        }
示例#2
0
 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();
 }