Pack URI and path not resolving image in WPF

前端 未结 3 661
梦如初夏
梦如初夏 2021-01-13 13:08

I have the following directory structure

Project
\\Images
 +view.png
control.xaml

and in the control I have a button defined by the followi

3条回答
  •  孤城傲影
    2021-01-13 13:30

    Xaml.VB

    Call the Image from Application folder and Design Page

    Private Sub LoadImages()
            Dim strUri As String
            strUri = AppDomain.CurrentDomain.BaseDirectory() & "\NavigationImages\settingsicon.png"
            Image2.Source = New BitmapImage(New Uri(strUri))
        End Sub
    

    Page load in Xaml.VB

    Call LoadImages()

    Xaml Design Page

    Image Name="Image2"Height="32" HorizontalAlignment="Left" 
    

提交回复
热议问题