I am trying to remove the first line of a paragraph when the total lines exceed a predetermined number of entries. This is for a kind of chat window and I do not want too many lines displayed at one time.
private Paragraph paragraph = new Paragraph();
public void WriteMessage(string output)
{
string outputFormat = string.Format("{0}", output);
string[] parts = output.Split(new char[]{':'}, 2);
string user = parts[0];
string[] username = parts[0].Split('!');
paragraph.Inlines.Add(new Run(username[0].Trim() + ": "){Foreground = UserColor});
paragraph.Inlines.Add(new Run(parts[1]) { Foreground = MessageColor});
paragraph.Inlines.Add(new LineBreak());
if (paragraph.Inlines.Count >= 50) {
//???
//The count does not actually count lines the way I would expect.
}
}
Not sure of the easiest way to do this, everything I have tried thus far has not worked.