I have CollapsibleSection objects that are dynamically being created in code. I would like to simply say:
CollapsibleSection section = new CollapsibleSection();
section.TextDecoration = TextDecorations.Strikethrough;
This is proving more difficult that I thought. Does anyone have some insight on a simple way to strikethrough the entire content of a collapsible section?
I’m missing something still. Here’s what I have so far:
public static readonly DependencyProperty TextDecorationProperty =
DependencyProperty.RegisterAttached("TextDecoration", typeof(TextDecoration),
typeof(CollapsibleSection));
In my method where I am creating my CollapsibleSection I have this:
CollapsibleSection cs = new CollapsibleSection();
if (flagIsTrue) {
section.SetValue(TextDecorationProperty, TextDecorations.Strikethrough);
}
These CollapbsibleSection’s are used to populate a FlowDocument.
I get this exception: ‘System.Windows.TextDecorationCollection’ is not a valid value of property ‘TextDecoration’.
What am I doing wrong?
I got the attached property to not throw an error by changing the parameter from
typeof(TextDecoration)totypeof(TextDecorationCollection)but the property never seemed to actually attach to theUIElementso I bagged it and just ended up setting the properly at the Paragraph level.Thank you for your help though.