问题描述
我想为主窗口设置Icon属性. form.xaml位于\ Views文件夹下,而ico文件位于\ Resources文件夹下.
如何将其指向\ Resources \ GreenFlag.ico?
我意识到如果我复制了将ico文件保存为与表单相同的文件夹(在views文件夹下),则可以很好地进行以下操作:
< Window x:Class ="Pent.Views.MainView"
xmlns =" http://schemas.microsoft.com/winfx/2006/xaml/presentation "
xmlns:x =" http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:c =" clr-namespace:PGBuildClient.Commands""
Title =应用程序";
高度="230"宽度="535".图标="GreenFlag.ico". >
但是,似乎我不能执行Icon ="\ Resource \ GreenFlags.ico".我目前正在编写代码来执行此操作,但仍然想知道为什么它在xaml中不起作用?
干杯
I want to set the Icon attribute for the main window. The form.xaml is located under \Views folder and the ico file is under \Resources folder.
How can I point it to \Resources\GreenFlag.ico?
I realised if i copy the ico file to the same folder as the form (under views folder), then the following works fine:
<Window x:Class="Pent.Views.MainView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:c="clr-namespace:PGBuildClient.Commands"
Title="Application"
Height="230" Width="535" Icon="GreenFlag.ico" >
However, it seems that I can not do Icon="\Resource\GreenFlags.ico". I currently write code to do this, but still wanna know why it does not work in xaml?
Cheers
推荐答案
这篇关于如何在XAML中设置表单图标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!