I have built a UserControl that is basically a grid that can have either rounded corners on each end, or a certain polygon. I have a Rounded property that changes the Visibility of the rounded border and the polygon to match (if someone sets Rounded="True", then the rounded border is visible and the polygon is hidden, and vice-versa.
Just like in this question: UserControl Dependency Property design time
...it works great at run-time, but I can't seem to get it to reflect the changes at design-time. However, restarting VS, cleaning the solution, rebuilding, changing the build target, etc - none of those steps seem to make a difference. My class is pretty basic:
public partial class MyBox : UserControl
{
public MyBox()
{
InitializeComponent();
}
public bool Rounded
{
get { return (bool)GetValue(RoundedProperty); }
set
{
SetValue(RoundedProperty, value);
this.edgeRounded.Visibility = (value ? Visibility.Visible : Visibility.Hidden);
this.edgePolygon.Visibility = (value ? Visibility.Hidden : Visibility.Visible);
}
}
public static readonly DependencyProperty RoundedProperty = DependencyProperty.Register("Rounded", typeof(bool), typeof(MyBox), new FrameworkPropertyMetadata(false, FrameworkPropertyMetadataOptions.AffectsRender));
}
Any ideas?