Programmatically changing button icon in WPF

前端 未结 4 1227
忘掉有多难
忘掉有多难 2020-12-01 12:50

I currently have a button, which has an icon/image on it. I have configured the button and image in XAML:

4条回答
  •  执笔经年
    2020-12-01 13:24

    Try this code

    window.Icon = BitmapFrame.Create(Application.GetResourceStream(new Uri("LiveJewel.png", UriKind.RelativeOrAbsolute)).Stream);
    

提交回复
热议问题