将UI字符串放入资源

时间:2017-02-21 04:50:20

标签: c# uwp

我按照将字符串放入资源文件中的说明,而不是直接将它们放在Put UI strings into resources中的代码或标记中(除了我不理解步骤4f)。解决方案资源管理器中项目资源的结构是:

enter image description here

这是项目共享节点的层次结构。我打开了Resources1.resw文件并添加了几个字符串。

然后在该文章中将字符串资源标识符添加到代码和标记具有以下内容:

var loader = new Windows.ApplicationModel.Resources.ResourceLoader();

当我得到时:

WinRT information: ResourceMap Not Found.

我尝试了很多其他的搜索功能,但是我得到了这个错误,或者我的项目中没有类或方法(在其他解决方案中)。我认为那篇文章中缺少一些相关内容。

使用C#,如何从该资源文件中获取字符串?

1 个答案:

答案 0 :(得分:4)

您无需重命名资源文件。如果资源文件的名称不是默认名称( $('img[src="delete.jpg"]').each(function(){ var e = $(this); var id = e.closest('tr').find('input').attr('id'); console.log( e, id ); }); // To store the id in image element: window.id_list = []; $('img[src="delete.jpg"]').each(function(){ var e = $(this); // image element var id = e.closest('tr').find('input').attr('id'); e.data('myid', id); id_list.push(id); }); // to access $('img[src="delete.jpg"]:first').data('id'); // or console.log(id_list); ),则可以在Resources.resw方法中添加特殊名称。
在你的情况下,电话应该是:

GetForCurrentView

来源:GetForCurrentView(System.String)