Oh OK, I did something similar with a control for visibility of the Toolbar. It would be the very similar. You need to set yourself up a public Enum for your types of Border
public enum BorderTypes
{
// Summary:
// Display the border as thick.
Thick = 0,
//
// Summary:
// Display the border as thin.
Thin = 1,
//
// Summary:
// Display the border as thinner.
Thinner = 2,
//
// Summary:
// Do not display the border.
None= 3,
}
Now I think this should work for you (fingers crossed)
#region BorderThicknessProperty DP
/// <summary>
/// Bound Data Dependency Property
/// </summary>
public static readonly DependencyProperty myBorderThicknessProperty =
DependencyProperty.Register("myBorderThickness", typeof(BorderTypes), typeof(TestControl),
new FrameworkPropertyMetadata(BorderTypes.Thick, new PropertyChangedCallback(OnBorderThicknessPropertyChanged)));
/// <summary>
/// Gets or sets the Bound Data property.
/// </summary>
public BorderTypes myBorderThickness
{
get { return (BorderTypes)GetValue(myBorderThicknessProperty); }
set { SetValue(myBorderThicknessProperty, value); }
}
/// <summary>
/// Handles changes to the ToolbarVisibility property.
/// </summary>
private static void OnBorderThicknessPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
BorderTypes ds = (BorderTypes)e.NewValue;
//Use a switch to set the thickness
switch (ds)
{
case BorderTypes.Thick :
{
((TestControl)d).<_Name of your control here to set the border thickness on_\>.BorderThickness = 10;
}
break;
}
}
#endregion
modified on Thursday, April 8, 2010 4:16 AM