How can I add background image to radiobutton in w

2019-09-19 00:07发布

问题:

How can I add an image to the radiobutton in WPF dynamically? is it possible?

回答1:

  myRadioButton.Content
      = new Image()
                {
                   Source =
                       (new ImageSourceConverter()).ConvertFrom(
                         "Images/pic.png") as
                             ImageSource
                }; 

This code will load an image "pic.png" in a radio button from local "Images" folder from same assembly.