Click here to Skip to main content
15,890,825 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Any ideas on websites or material that can guide me through creating a WPF application in VB.Net.
This is my first time using this and I am not sure how to add functions to my controls for example this is my WPF code:
<pre lang="HTML"><Window x:Class="MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="MainWindow" Height="481" Width="675" DataContext="{Binding}">
    <Grid>
        <Menu Height="27" HorizontalAlignment="Left" Margin="2,0,0,0" Name="Menu1" VerticalAlignment="Top" Width="651">
            <Menu.Background>
                <LinearGradientBrush EndPoint="1,0.5" StartPoint="0,0.5">
                    <GradientStop Color="Black" Offset="0" />
                    <GradientStop Color="White" Offset="0.058" />
                </LinearGradientBrush>
            </Menu.Background>
            <MenuItem Header="File" Name="File">
                <MenuItem Header="New File" Command="ApplicationCommands.New" IsCheckable="True"  />
                <MenuItem Header="Open" Command="ApplicationCommands.Open" IsCheckable="True" />
                <MenuItem Header="Save" Command="ApplicationCommands.Save" IsCheckable="True" />
                <MenuItem Header="Save As" Command="ApplicationCommands.SaveAs" IsCheckable="True" />
                <MenuItem Header="Close" Command="ApplicationCommands.Close" IsCheckable="True" />
            </MenuItem>
            <MenuItem Header="Setup" Name="Setup">
                <MenuItem Header="Customer information" IsCheckable="False" IsEnabled="False" />
                <Separator />
            </MenuItem>
            <MenuItem Header="Reports" />
            <MenuItem Header="Calculation tools" />
        </Menu>
        <Image Height="126" HorizontalAlignment="Left" Margin="246,157,0,0" Name="Image1" Stretch="Fill" VerticalAlignment="Top" Width="189" Source="/WpfApplication1;component/Images/Baker%20Blue%20and%20black.jpg" />
        <Grid.Background>
            <LinearGradientBrush EndPoint="1,0.5" StartPoint="0,0.5">
                <GradientStop Color="Black" Offset="0" />
                <GradientStop Color="#FFB5FFF9" Offset="0.512" />
            </LinearGradientBrush>
        </Grid.Background>
    </Grid>
</Window>


Now on my menu bar I have the navigations functions in Place but do not know how to make the menu items actually navigate.

Example a Windows for application that allow me to click on the menu and navigate to form2 in plain VB I would simply enter the following code:

VB
Private Sub InventorySteupToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles InventorySteupToolStripMenuItem.Click
        'Inventory setup directory
        Inventory.Show()
        Inventory.MdiParent = Me
    End Sub

Not sure how to make the two tak to each other. Plese help.
Posted
Comments
[no name] 30-Aug-12 21:12pm    
See if this helps, http://japikse.blogspot.com/2008/07/wpf-menus-and-commands.html
icecode 31-Aug-12 22:27pm    
It seems a lot of articles are referring to the collaboration of C# and WPF. I a working with visual basic I have Very little knowledge of C#. Does this mean that I should start learning C# in order to reach full potential of the WPF architecture?

1 solution

There are lots of resources and articles here on CodeProject[^].
 
Share this answer
 
Comments
Member 11287123 21-Feb-16 13:18pm    
I am learning WPF in vb.net and I am on menus. I don't see how I can use index with menu as I have to use a new click event for each item within the particular group. In Windows vb.net I am able to use filename(index) instead of having a sub for each menuitem and having to duplicate the code for each menuitem.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900