cross platform - Create Application bar dynamically -
i want create application bar dynamically in windows phone 8
. have used following code create application bar in appbar.cs file
class appbar { public appbar() { applicationbar appbar; this.appbar = new applicationbar(); this.appbar.isvisible = true; this.appbar.opacity = 1; this.appbar.mode = applicationbarmode.minimized; applicationbariconbutton appbuton = new applicationbariconbutton(); appbuton.iconuri = new uri("/images/show.png", urikind.relative); appbuton.text = "show"; this.appbar.buttons.add(appbuton); appbuton.click += appbuton_click; } } void appbuton_click(object sender, eventargs e) { } }
if have created instance of appbar class, methods called unable see application bar. have given request create appbar webview
. javainterface have created instance of application bar given text , icon. how show in web page.
i have solved application bar issue. added application bar parent element(phoneapplicationpage)
.
class appbar { public appbar() { applicationbar appbar; phoneapplicationpage parentpage = (application.current.rootvisual contentcontrol).content phoneapplicationpage; parentpage.applicationbar = new applicationbar(); appbar = parentpage.applicationbar; appbar.isvisible = true; appbar.opacity = 1; appbar.mode = applicationbarmode.minimized; applicationbariconbutton appbuton = new applicationbariconbutton(); appbuton.iconuri = new uri("/images/show.png", urikind.relative); appbuton.text = "show"; appbar.buttons.add(appbuton); appbuton.click += appbuton_click; } } void appbuton_click(object sender, eventargs e) { } }
Comments
Post a Comment