请教VB.net里.xaml页面之间跳转方法

zhabu 2010-04-14 09:13:27
那位朋友知道Silverlight中怎么样在两个.xaml页面之间跳转。
这两天一直在查资料但是都是C#的程序没有VB的!
...全文
124 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
jv9 2010-04-14
  • 打赏
  • 举报
回复
VB和C#是一样的只是语法不同。

在App.xaml中

Dim pager As New PageNavigator()
Me.RootVisual = pager
Navigator.pager = pager
Navigator.Switch(New Login())



PageNavigator.xaml.vb

Partial Public Class PageNavigator
Inherits UserControl

Public Sub New
InitializeComponent()
End Sub

Public Sub Navigate(ByVal nextPage As UserControl)
Me.Content = nextPage
End Sub

Public Sub Navigate(ByVal nextPage As UserControl, ByVal state As Object)
Me.Content = nextPage
Dim nav As INavigator = TryCast(nextPage, INavigator)
If nav IsNot Nothing Then
nav.UtilizeState(state)
Else
Throw New ArgumentException("nextPage cannot be found! " & nextPage.Name.ToString())
End If
End Sub
End Class


Navigator.vb


Public NotInheritable Class Navigator

Public Shared pager As PageNavigator

Private Sub New()
End Sub

Public Shared Sub Switch(ByVal newPage As UserControl)
pager.Navigate(newPage)
End Sub

Public Shared Sub Switch(ByVal newPage As UserControl, ByVal state As Object)
pager.Navigate(newPage, state)
End Sub

End Class





INavigator.vb

Public Interface INavigator
Sub UtilizeState(ByVal state As Object)
End Interface



详细参考这里:
http://silverlightchina.net/html/tips/2010/0119/600.html

http://silverlightchina.net/html/tips/2010/0317/856.html
Paperback: 1625 pages Publisher: Apress; 7th ed. 2015 edition (January 1, 2016) Language: English ISBN-10: 1484213335 ISBN-13: 978-1484213339 This new 7th edition of Pro C# 6.0 and the .NET 4.6 Platform has been completely revised and rewritten to reflect the latest changes to the C# language specification and new advances in the .NET Framework. You'll find new chapters covering all the important new features that make .NET 4.6 the most comprehensive release yet, including: A Refined ADO.NET Entity Framework Programming Model Numerous IDE and MVVM Enhancements for WPF Desktop Development Numerous updates to the ASP.NET Web APIs This comes on top of award winning coverage of core C# features, both old and new, that have made the previous editions of this book so popular. Readers will gain a solid foundation of object-oriented development techniques, attributes and reflection, generics and collections as well as numerous advanced topics not found in other texts (such as CIL opcodes and emitting dynamic assemblies). The mission of this book is to provide you with a comprehensive foundation in the C# programming language and the core aspects of the .NET platform plus overviews of technologies built on top of C# and .NET (ADO.NET and Entity Framework, Windows Communication Foundation (WCF), Windows Presentation Foundation (WPF), ASP.NET (WebForms, MVC, WebAPI).). Once you digest the information presented in these chapters, you’ll be in a perfect position to apply this knowledge to your specific programming assignments, and you’ll be well equipped to explore the .NET universe on your own terms. What you’ll learn Be the first to understand the .NET 4.6 platform and C# 6. Discover the ins and outs of the leading .NET technology. Learn from an award-winning author who has been teaching the .NET world since version 1.0. Find complete coverage of XAML, .NET 4.6 and Visual Studio 2015 together with discussion of the new Windows Runtime. Who this book is for This book is perfect for anyone who is interested in the new .NET Framework 4.6 and the C# language. Whether you are moving to .NET for the first time or are already writing applications using previous .NET versions, this book will provide you with a comprehensive grounding in the new technology and serve as a complete reference throughout your coding career.

8,741

社区成员

发帖
与我相关
我的任务
社区描述
WPF/Silverlight相关讨论
社区管理员
  • WPF/Silverlight社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧