I've tried without success to set the icon of a button in MaterialWindow TitleTemplate using the following code:
var iconFieldUser = (this.TitleTemplate.LoadContent() as Grid).FindName("iconFieldUser") as PackIcon;
iconFieldUser.Kind = PackIconKind.LocalAreaNetworkConnect;
iconFieldUser.Foreground = Brushes.LightSeaGreen;
iconFieldUser.InvalidateVisual();
Running the above code not changing anything.
More, when I use TitleTemplate in MaterialWindow I get errors like the one below:
System.Windows.Data Error: 4 : Cannot find source for binding with reference 'RelativeSource FindAncestor, AncestorType='MaterialDesignExtensions.Controls.MaterialWindow', AncestorLevel='1''. BindingExpression:Path=BorderForegroundBrush; DataItem=null; target element is 'Button' (Name='fieldUser'); target property is 'Foreground' (type 'Brush')
I've tried without success to set the icon of a button in MaterialWindow TitleTemplate using the following code:
Running the above code not changing anything.
More, when I use TitleTemplate in MaterialWindow I get errors like the one below:
System.Windows.Data Error: 4 : Cannot find source for binding with reference 'RelativeSource FindAncestor, AncestorType='MaterialDesignExtensions.Controls.MaterialWindow', AncestorLevel='1''. BindingExpression:Path=BorderForegroundBrush; DataItem=null; target element is 'Button' (Name='fieldUser'); target property is 'Foreground' (type 'Brush')