private void BtnSendImage_Click(object sender, RoutedEventArgs e)
        {
            Microsoft.Win32.OpenFileDialog openFileDialog = new Microsoft.Win32.OpenFileDialog
            {
                DefaultExt = ".jpg",
                Filter     = "Image files (*.jpg, *.jpeg, *.jpe, *.jfif, *.png) | *.jpg; *.jpeg; *.jpe; *.jfif; *.png"
            };

            var result = openFileDialog.ShowDialog();

            if (result == true)
            {
                ScrollViewer scrollViewer = CreateScrollViewer();

                Grid grid = CreateGridWithOneTextBlock();

                Image image = new Image
                {
                    Width  = 200,
                    Height = 100,
                    Source = new BitmapImage(new Uri(openFileDialog.FileName)),
                    Margin = new Thickness(ScrlVwrFirst.ActualWidth - 250, 0, 0, 0)
                };

                grid.Children.Add(image);

                scrollViewer.Content = grid;

                LstBxMessages.Items.Add(scrollViewer);
                LstBxMessages.ScrollIntoView(LstBxMessages.Items[LstBxMessages.Items.Count - 1]);
            }

            TxtBxMessage.Focus();
        }
        private void BtnSendText_Click(object sender, RoutedEventArgs e)
        {
            if (!string.IsNullOrWhiteSpace(TxtBxMessage.Text))
            {
                ScrollViewer scrollViewer = CreateScrollViewer();

                Grid grid = CreateGridWithOneTextBlock();

                var textBlockSecond = new TextBlock
                {
                    TextWrapping = TextWrapping.Wrap,
                    MaxWidth     = 210,
                    Margin       = new Thickness(ScrlVwrFirst.ActualWidth - 250, 0, 0, 0),
                    Text         = $"{TxtBxMessage.Text}"
                };

                grid.Children.Add(textBlockSecond);

                scrollViewer.Content = grid;

                TxtBxMessage.Text = default;

                LstBxMessages.Items.Add(scrollViewer);
                LstBxMessages.ScrollIntoView(LstBxMessages.Items[LstBxMessages.Items.Count - 1]);
            }

            TxtBxMessage.Focus();
        }
 public MainWindow()
 {
     InitializeComponent();
     TxtBxMessage.Focus();
 }