@Nicholas Piazza, Welcome to Microsoft Q&A, based on my test, I reproduced your problem in the c# code but not in Xaml Code.
For Xaml code, please check if your path is correct, like the following:
<Grid x:Name="grid1">
<BulletDecorator>
<BulletDecorator.Bullet>
<Image Width="10" Source="images/Icon.bmp"/>
</BulletDecorator.Bullet>
<TextBlock Margin="20,0,0,0">My Expander</TextBlock>
</BulletDecorator>
</Grid>
Path:
In c# code, we need to add BitmapImage.BeginInit() method and BitmapImage.EndInit() method to the current code.
Like the following:
public MainWindow()
{
InitializeComponent();
BulletDecorator bp = new BulletDecorator();
Image i = new Image();
BitmapImage bi = new BitmapImage();
bi.BeginInit();
bi.UriSource = new Uri(@"pack://application:,,/images/Icon.bmp");
bi.EndInit();
i.Source = bi;
i.Width = 10;
bp.Bullet = i;
TextBlock tb = new TextBlock();
tb.Text = "My Expander";
tb.Margin = new Thickness(20, 0, 0, 0);
bp.Child = tb;
//Create the image element.
Image simpleImage = new Image();
simpleImage.Width = 200;
simpleImage.Margin = new Thickness(5);
grid1.Children.Add(bp);
}
My tested result:
For the c# code problem, I recommend that you could give the feedback in the Microsoft Learning page:
Update:
The Bullet could not work in .NET 5,6 or 7 wpf app, because Microsoft stated that it is currently only supported in .NET Framework version.
But we also could request a feature about it in DC.
Hope my explanation could help you.
Best Regards,
Jack
If the answer is the right solution, please click "Accept Answer" and upvote it.If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.