Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3614402
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T22:14:39+00:00 2026-05-18T22:14:39+00:00

Basic layout (VB.NET & WPF/XBAP) : I have a MainPage – mainpage.xaml Inside the

  • 0

Basic layout (VB.NET & WPF/XBAP):

I have a MainPage – mainpage.xaml
Inside the MainPage I have a frame that hosts other pages. The first page that is auto loaded is the LogIn – LogIn.xaml

The user enters their email to login (no password required, just email to identify, its an internal app so passwords are not required or even wanted by users).

On MainPage.xaml the header should have a “Hello ” TexBlock (name: ui_txbUserName). The LogIn page has a method which on submit gets the UserID (for other reasons and saves it) and the User Name.

I want to change the ui_txbUserName when the person logs in and update if he/she logs out of one account into another. I have looked at INotifyPropertyChanged and Dependency Properties and im just not sure how to go about doing this! Any help would be awesome!!!

Thanks!

UsingOfficerID – its a global variable set when a person logs in, its used all over the place in the application.

I have tried the Following inside the sample app:

http://www.2shared.com/file/68enzucg/SampleApp.html

None of this is reflected in the UI

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T22:14:40+00:00Added an answer on May 18, 2026 at 10:14 pm

    Ok, I thought I’d add another answer which addresses the specifics of your sample application. I’ve had a look through the sample, but the code seems to be a bit in a state of flux! Firstly, you haven’t set the DataContext of MainWindow (the view) anywhere, this should be set to an instance of your view model (UserViewModel.vb, although I would consider renaming either the view or the view model so that they are e.g. MainView and MainViewModel).

    You can set the DataContext in several ways, using a view first or view model first approach. One quick way to start testing is in the constructor of your view:

    // MainWindow.xaml.vb
    Class MainWindow
    
      Public Sub New()
    
          InitializeComponent()
    
          Me.DataContext = New UserViewModel()
    
      End Sub
    
    End Class
    

    Now, in your UserViewModel, you have a UserName property, but it seems to return and set a User object username property. Even though the user object never seems to be set anywhere. To keep things simple, I just used a string instead with a new backing field:

    Private _username As String
    Public Property UserName() As String
         Get
             Return _username
         End Get
         Set(ByVal Value As String)
             _username = Value
             MyBase.OnPropertyChanged("UserName")
         End Set
    End Property
    

    Originally, you had called MyBase.OnPropertyChanged(“Address”) for some reason?? Maybe this was a copy/paste error, but the string value must match the name of the property whose value has changed, as the binding engine will use reflection to retrieve the new property value.

    Finally, I just changed the binding expression in MainWindow.xaml

    <TextBlock Grid.Row="0" Text="{Binding UserName}" />
    

    Because the DataContext isn’t explicitly set on the TextBlock, it will use the DataContext of the view (UserControl) which is set to an instance of UserViewModel. This means that it will bind to a UserName property on that DataContext which is what you want. To test it, you can set the value of Me.UserName = “Something” in the constructor of the UserViewModel.

    Hopefully you can see how the binding works for strings, and you can work out where you need to go to get it working for your User type.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an ASP.NET site that I'm developing. The layout is pretty basic. The
I have a basic layout that is one Div container wrapper and three columns
In ASP.Net you'd create a MasterPage and have whatever pages use that. I need
I have 2 spark labels next to each other. They are in a basic
I have implemented a basic page layout algorithm for footnote placement. Basically: Layout a
I have a Rails-based site with a basic two-column layout. On the right is
The basic layout of my problem is this: Website (ASP.NET/C#) hosted at a dedicated
I have a basic Layout question. When using the layout tab (rather than the
I've got two sizing issue regarding a Window I've got. The basic layout is
Basic premise: I have a Room which publishes an event when an Avatar enters

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.