I am trying to set background color of some icon via binding, but I'm probably missing something and don't know what.
The xaml:
<materialDesign:PackIcon x:Name="SaveIcon" Kind="ContentSave"
Height="25" Width="25" Background="{Binding Background}" />
Code behind:
public Page6()
{
InitializeComponent();
DataContext = this;
Background = "Red";
}
private string _background;
public string Background
{
get
{
return _background;
}
set
{
_background = value;
OnPropertyChanged();
}
}
public event PropertyChangedEventHandler PropertyChanged;
private void OnPropertyChanged([CallerMemberName] string propertyName=null)
{
PropertyChanged?.Invoke(this , new PropertyChangedEventArgs(propertyName));
}
But this don't do nothing, I mean there is no background color.
Backgroundproperty is of typeBrush, notstring, but I can't test it right now