Reputation: 21998
public double FontSize
{
get { return (double)GetValue(FontSizeProperty); }
set { SetValue(FontSizeProperty, value); }
}
public static readonly DependencyProperty FontSizeProperty =
TextElement.FontSizeProperty.AddOwner(typeof(OutlineTextBlock),
new FrameworkPropertyMetadata(XXX, FrameworkPropertyMetadataOptions.AffectsRender));
I don't want to specify XXX
and there is no override to specify only AffectsRender
.
If I do like this
new FrameworkPropertyMetadata()
then property will take default value from somewhere.
How to specify AffectsRender
without default value?
Upvotes: 1
Views: 490
Reputation: 19426
Try the following
new FrameworkPropertyMetadata { AffectsRender = true; }
By not specifying a default value, the base PropertyMetadata
does not get flagged as the default value being modified. This ensures when the metadata is merged, the original default value is used but the AffectsRender
flag is added.
Upvotes: 3