none
custom control in javascript

Answers

  • Hi,

    if you want to reuse some HTML across multiple sites you can do it in the following way: Imagine you have a footer which you want to display on every page. The footer is defined as follows (taken from the "App settings sample" - http://code.msdn.microsoft.com/windowsapps/App-settings-sample-1f762f49):

    <!DOCTYPE html> 
    <html xmlns="http://www.w3.org/1999/xhtml"> 
        <head> 
            <title></title> 
        </head> 
        <body> 
            <img id="footerLogo" src="/images/microsoft-sdk.png" alt="Microsoft"/> 
            <div id="footerText"> 
                <div id="company" class="company"><span>Copyright © Microsoft Corporation. All rights reserved.</span></div> 
                <div id="links" class="links"> 
                    <a href="http://www.microsoft.com/About/Legal/EN/US/IntellectualProperty/Copyright/default.aspx">Terms of use</a> 
                    <span class="pipe"></span> 
                    <a href="http://www.microsoft.com/About/Legal/EN/US/IntellectualProperty/Trademarks/EN-US.aspx">Trademarks</a> 
                    <span class="pipe"></span> 
                    <a href="http://privacy.microsoft.com">Privacy Statement</a> 
                </div> 
            </div> 
        </body> 
    </html>

    In your site you can use this footer like this

    <div id="footer" data-win-control="WinJS.UI.HtmlControl" data-win-options="{uri: '/sample-utils/footer.html'}"></div>

    Best Regards. When you see answers and helpful posts, please click Vote As Helpful, Propose As Answer, and/or Mark As Answer. This helps us build a healthy and positive community.

    Sunday, June 10, 2012 1:14 AM

All replies

  • Hi,

    if you want to reuse some HTML across multiple sites you can do it in the following way: Imagine you have a footer which you want to display on every page. The footer is defined as follows (taken from the "App settings sample" - http://code.msdn.microsoft.com/windowsapps/App-settings-sample-1f762f49):

    <!DOCTYPE html> 
    <html xmlns="http://www.w3.org/1999/xhtml"> 
        <head> 
            <title></title> 
        </head> 
        <body> 
            <img id="footerLogo" src="/images/microsoft-sdk.png" alt="Microsoft"/> 
            <div id="footerText"> 
                <div id="company" class="company"><span>Copyright © Microsoft Corporation. All rights reserved.</span></div> 
                <div id="links" class="links"> 
                    <a href="http://www.microsoft.com/About/Legal/EN/US/IntellectualProperty/Copyright/default.aspx">Terms of use</a> 
                    <span class="pipe"></span> 
                    <a href="http://www.microsoft.com/About/Legal/EN/US/IntellectualProperty/Trademarks/EN-US.aspx">Trademarks</a> 
                    <span class="pipe"></span> 
                    <a href="http://privacy.microsoft.com">Privacy Statement</a> 
                </div> 
            </div> 
        </body> 
    </html>

    In your site you can use this footer like this

    <div id="footer" data-win-control="WinJS.UI.HtmlControl" data-win-options="{uri: '/sample-utils/footer.html'}"></div>

    Best Regards. When you see answers and helpful posts, please click Vote As Helpful, Propose As Answer, and/or Mark As Answer. This helps us build a healthy and positive community.

    Sunday, June 10, 2012 1:14 AM
  • Can you give an example of what you control will be or how it will behave?  You can encapsulate behavior in WinMD components, and you can use functions and objects defined in Javascript.

    -Jeff


    Jeff Sanders (MSFT)

    Tuesday, June 12, 2012 8:00 PM
  • The answer to this question is in this blog post:

    Building a custom control using the Windows Library for JavaScript (WinJS)


    Tiago Andrade e Silva

    Wednesday, December 26, 2012 9:42 PM