WPF菜单和标题图像
我需要在我的菜单标题中有一个图像而不是文本。我已经写了一个代码,但它没有显示图像 下面是我的xaml部分WPF菜单和标题图像,wpf,menu,Wpf,Menu,我需要在我的菜单标题中有一个图像而不是文本。我已经写了一个代码,但它没有显示图像 下面是我的xaml部分 <Menu Height="50" Width="50" VerticalAlignment="Top" IsMainMenu="True"> <MenuItem Height="50" Width="50"> <MenuItem.Header>
<Menu Height="50" Width="50" VerticalAlignment="Top" IsMainMenu="True">
<MenuItem Height="50" Width="50">
<MenuItem.Header>
<Image HorizontalAlignment="Left" Height="50" VerticalAlignment="Top" Width="50" Source="Images/pulsesi_icon_black.PNG"/>
</MenuItem.Header>
</MenuItem>
</Menu>
帮我解决这个问题,我不需要图标。您可以使用Menuitem.Icon作为标题中的图像
<MenuItem >
<MenuItem.Icon>
<Image Width="20" Height="20" Source="/Resources/Images/Key.jpg" />
</MenuItem.Icon>
</MenuItem>
图像。源路径可能错误。你确定,你在同一个项目中有图像,并且图像BuildAction
设置为Resrouce
?你有没有图像?没有,我在那里没有看到任何图像,我的文件夹中有图像。你的图像文件夹在哪里?意味着图像文件夹应该在您的项目中,我在我的项目中使用上述代码。