|
Imports System
Imports System.Collections.Generic
Imports System.Linq
Imports System.Text
Imports System.Windows
Imports System.Windows.Controls
Imports System.Windows.Data
Imports System.Windows.Documents
Imports System.Windows.Input
Imports System.Windows.Media
Imports System.Windows.Media.Imaging
Imports System.Windows.Navigation
Imports System.Windows.Shapes
''' <summary>
''' Simply launches the reqested demo window, oh and
''' also demonstrates the use of a DataTemplate within
''' the associated DemoLauncherWindow.xaml
''' </summary>
Partial Public Class DemoLauncherWindow
Inherits Window
''' <summary>
''' Constructs a new DemoLauncherWindow, and
''' creates a bunch of <see cref="DemoListItem">
''' DemoListItem</see> items to be used within the
''' contained ListBox
''' </summary>
Public Sub New()
InitializeComponent()
'Create the demo list items
Dim newitem1 As New DemoListItem
newitem1.DemoName = "Hierarchical Template Example"
newitem1.WindowName = "HierarchicalDataTemplateWindow.xaml"
lstDemos.Items.Add(newitem1)
Dim newitem2 As New DemoListItem
newitem2.DemoName = "Planets ListBox Template Example"
newitem2.WindowName = "PlanetsListBoxWindow.xaml"
lstDemos.Items.Add(newitem2)
Dim newitem3 As New DemoListItem
newitem3.DemoName = "Various Control Templates Example"
newitem3.WindowName = "VariousControlTemplatesWindow.xaml"
lstDemos.Items.Add(newitem3)
End Sub
''' <summary>
''' Show the demo window requested
''' </summary>
Private Sub lstDemos_SelectionChanged(ByVal sender As Object, ByVal e As SelectionChangedEventArgs)
Dim winName As String = TryCast(lstDemos.SelectedItem, DemoListItem).WindowName
Dim win As Window = Nothing
Select Case winName
Case "HierarchicalDataTemplateWindow.xaml"
win = New HierarchicalDataTemplateWindow()
Exit Select
Case "PlanetsListBoxWindow.xaml"
win = New PlanetsListBoxWindow()
Exit Select
Case "VariousControlTemplatesWindow.xaml"
win = New VariousControlTemplatesWindow()
Exit Select
End Select
win.Owner = Me
win.Width = Me.Width
win.Height = Me.Height
win.WindowStartupLocation = WindowStartupLocation.CenterOwner
win.ShowInTaskbar = False
win.ResizeMode = ResizeMode.NoResize
win.ShowDialog()
End Sub
End Class
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
I currently hold the following qualifications (amongst others, I also studied Music Technology and Electronics, for my sins)
- MSc (Passed with distinctions), in Information Technology for E-Commerce
- BSc Hons (1st class) in Computer Science & Artificial Intelligence
Both of these at Sussex University UK.
Award(s)
I am lucky enough to have won a few awards for Zany Crazy code articles over the years
- Microsoft C# MVP 2016
- Codeproject MVP 2016
- Microsoft C# MVP 2015
- Codeproject MVP 2015
- Microsoft C# MVP 2014
- Codeproject MVP 2014
- Microsoft C# MVP 2013
- Codeproject MVP 2013
- Microsoft C# MVP 2012
- Codeproject MVP 2012
- Microsoft C# MVP 2011
- Codeproject MVP 2011
- Microsoft C# MVP 2010
- Codeproject MVP 2010
- Microsoft C# MVP 2009
- Codeproject MVP 2009
- Microsoft C# MVP 2008
- Codeproject MVP 2008
- And numerous codeproject awards which you can see over at my blog