private void DirectlyPlaceUIContent(UIElement element)
{
if (ResultGroup == null)
{
ResultGroup = new StackPanel { Orientation = Orientation.Vertical, Margin = new Thickness(0)};
if (Result.Blocks.Count == 0)
{
//nothing here yet so lets just ignore the current result and move on
}
else
{
ResultGroup.Children.Add(Result);
}
}
else if(ResultGroup.Children.Last() is RichTextBox && ((RichTextBox)ResultGroup.Children.Last()).Blocks.Count == 0)
{
ResultGroup.Children.Remove(ResultGroup.Children.Last());
}
ResultGroup.Children.Add(element);
ResultGroup.Children.Add(Result = new RichTextBox { TextWrapping = TextWrapping.Wrap, Margin = new Thickness(-6, 6, 4, 6) });
_textLengthInCurrent = 0;
}