A RichTextBox puts extra space between lines when a user presses enter or inserts text, and that's what I'm trying to get away from. I searched around and the only decent solution I found is this one:
Setter SetParagraphMargin = new Setter();
SetParagraphMargin.Property = Paragraph.MarginProperty;
SetParagraphMargin.Value = new Thickness(0);
Style style = new Style();
style.TargetType = typeof(Paragraph);
style.Setters.Add(SetParagraphMargin);
rtb.Resources.Add("Style", style);
But this still doesn't work. Does anyone have any tips for me?
I did it with property thickness
I had the same problem, and i solved it by modifying the Xaml of the RichTextBox:
Don't know how that's different than setting the style manually like you did, but for me it worked.
Update: To change it in code, you need to use the target type as key: