Assign a Name to the ImageBrush:
<ImageBrush x:Name="imageBrush" ImageSource="Images\music.png" Stretch="None"/>
Then use the named member in code:
var filename = @"Images\title.png";
imageBrush.ImageSource = new BitmapImage(new Uri(filename, UriKind.Relative));
Or simply cast the value of the Border's Background
property to type ImageBrush:
var imageBrush = (ImageBrush)hej1.Background;
var filename = @"Images\title.png";
imageBrush.ImageSource = new BitmapImage(new Uri(filename, UriKind.Relative));