C
C#2y ago
Indeed

❔ WPF Border TemplateBinding

Hi! I've created such style for most of my controls to have rounded corners however i would like for them to be modifiable ive written an attached property however i do not have a way to bind it style
<Style x:Key="RoundBorder">
<Style.Resources>
<Style TargetType="Border">
<Setter Property="CornerRadius" Value="3" />
</Style>
</Style.Resources>
</Style>
<Style x:Key="RoundBorder">
<Style.Resources>
<Style TargetType="Border">
<Setter Property="CornerRadius" Value="3" />
</Style>
</Style.Resources>
</Style>
property
public static class ThemeProperties {
public static float GetRoundedCornerRadius(DependencyObject obj) {
return (float)obj.GetValue(RoundedCornerRadiusProperty);
}
public static void SetRoundedCornerRadius(DependencyObject obj, float value) {
obj.SetValue(RoundedCornerRadiusProperty, value);
}
public static readonly DependencyProperty RoundedCornerRadiusProperty =
DependencyProperty.RegisterAttached("RoundedCornerRadius", typeof(float), typeof(ThemeProperties), new PropertyMetadata(3f));
}
public static class ThemeProperties {
public static float GetRoundedCornerRadius(DependencyObject obj) {
return (float)obj.GetValue(RoundedCornerRadiusProperty);
}
public static void SetRoundedCornerRadius(DependencyObject obj, float value) {
obj.SetValue(RoundedCornerRadiusProperty, value);
}
public static readonly DependencyProperty RoundedCornerRadiusProperty =
DependencyProperty.RegisterAttached("RoundedCornerRadius", typeof(float), typeof(ThemeProperties), new PropertyMetadata(3f));
}
normally one would use a template binding in the style but i cant do that while keeping the style generic
1 Reply
Accord
Accord2y ago
Looks like nothing has happened here. I will mark this as stale and this post will be archived until there is new activity.
Want results from more Discord servers?
Add your server