i am trying to style a border brush based on the selected colour in a colour picker control
as shown below
XAML side
<Border Width="50"
Height="500"
BorderThickness="5"
CornerRadius="12"
Background="{DynamicResource DarkBackgroundBrush}"
BorderBrush="{Binding BorderColour}"
Visibility="Visible"/>
ViewModel side
private Brush _borderColour;
public Brush BorderColour
{
get
{
return _borderColour;
}
set
{
if (value != _borderColour)
{
_borderColour = value;
NotifyPropertyChanged(nameof(BorderColour));
}
}
}
i am not getting any errors except from this Cannot find governing FrameworkElement or FrameworkContentElement for target element
when i debug, nothing is null and i can assign the selected colour value but it’s never shown in xaml, i think i am missing some sort of converting but not sure how to fix it.
any idea please?
This might be the problem with mentioned
Colour Picker Control
, because when set default value toprivate Brush _borderColour = new SolidColorBrush(Colors.LimeGreen);
, it’s being shown correctly. Provide full XAML and ViewModel code to reproduce the issue.Does it work if you hard code a brush? Unclear what the picker is returning.