{"id":1082,"date":"2020-11-04T14:18:24","date_gmt":"2020-11-04T14:18:24","guid":{"rendered":"https:\/\/ibex.tech\/windows-iot\/?p=1082"},"modified":"2025-04-16T14:59:32","modified_gmt":"2025-04-16T13:59:32","slug":"copy-existing-page","status":"publish","type":"post","link":"https:\/\/ibex.tech\/csharp\/uwp-programming-in-c\/projects-general\/copy-existing-page","title":{"rendered":"Copy existing page"},"content":{"rendered":"\n<h5 class=\"wp-block-heading\">Create new file pair<\/h5>\n\n\n\n<p>Right click the .xaml file and select copy<\/p>\n\n\n\n<p>Select the project &gt; Right click &gt; Paste<\/p>\n\n\n\n<p>You will now have a duplicate of the page and its .cs source code file with &#8221; &#8211; Copy.xaml&#8221; as its name.<\/p>\n\n\n\n<p>Right click the .xaml file and select Rename to rename both the files for the new page.<\/p>\n\n\n\n<h5 class=\"wp-block-heading\">Update page code<\/h5>\n\n\n\n<p>Renaming the file pair won&#8217;t have caused the files class to have been renamed, so view the code.<\/p>\n\n\n\n<p>Use find and replace to rename the class (probably 2 in 2 places)<\/p>\n\n\n\n<h5 class=\"wp-block-heading\">Update xaml<\/h5>\n\n\n\n<p>Update the  x:Class= class name<\/p>\n\n\n\n<h5 class=\"wp-block-heading\">If it doesn&#8217;t work!<\/h5>\n\n\n\n<p>Look in the drop down of the original .xaml file and see if the copy of the .cs file is in there &#8211; likely is. Delete them both and start over. This time copy both files and rename them in the file manager. Take care when renaming with the .cs file &#8211; its MyFileName.xaml.cs<\/p>\n\n\n\n<p>Repeat the changes needed as above in the files. <\/p>\n\n\n\n<p>Now in Visual Studio use Add > Existing item > Select both the files.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Create new file pair Right click the .xaml file and select copy Select the project &gt; Right click &gt; Paste You will now have a duplicate of the page and its .cs source code file with &#8221; &#8211; Copy.xaml&#8221; as its name. Right click the .xaml file and select Rename to rename both the files [&hellip;]<\/p>\n","protected":false},"author":5,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4,75],"tags":[],"class_list":["post-1082","post","type-post","status-publish","format-standard","hentry","category-projects-general","category-pages"],"_links":{"self":[{"href":"https:\/\/ibex.tech\/csharp\/wp-json\/wp\/v2\/posts\/1082","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ibex.tech\/csharp\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ibex.tech\/csharp\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ibex.tech\/csharp\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/ibex.tech\/csharp\/wp-json\/wp\/v2\/comments?post=1082"}],"version-history":[{"count":3,"href":"https:\/\/ibex.tech\/csharp\/wp-json\/wp\/v2\/posts\/1082\/revisions"}],"predecessor-version":[{"id":1390,"href":"https:\/\/ibex.tech\/csharp\/wp-json\/wp\/v2\/posts\/1082\/revisions\/1390"}],"wp:attachment":[{"href":"https:\/\/ibex.tech\/csharp\/wp-json\/wp\/v2\/media?parent=1082"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ibex.tech\/csharp\/wp-json\/wp\/v2\/categories?post=1082"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ibex.tech\/csharp\/wp-json\/wp\/v2\/tags?post=1082"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}