Click here to Skip to main content
15,947,612 members

Comments by DRD94 (Top 12 by date)

DRD94 17-Jul-17 6:08am View    
I do it in the XAML like so: <vm:DashboardViewModel x:Key="DashboardViewModel"/> in the resources section and then

    <UserControl.DataContext>
        <Binding Mode="OneWay" Source="{StaticResource DashboardViewModel}"/>
    </UserControl.DataContext>
DRD94 17-Jul-17 4:29am View    
Pretty confused now. The breakpoint is only hit once and FirstName/LastName are set correctly. If I add in a MessageBox to the end of the OnUserReceived method and follow through the debugger, it looks like the ViewModel is initialised before the View. Is there a way I can check the View (and its TextBlocks) are initialised before the ViewModel? Maybe the sending of the ViewModel to change ViewModels is messing this up?
DRD94 17-Jul-17 4:06am View    
I have a black background hence the white. I changed it to red and no luck still. If I set the button to something like MessageBox.Show(FirstName);, so that is after FirstName should be set to the passed value it just shows null. It seems to me that FirstName is being set where the breakpoint is being hit but then being wiped again for some reason.
DRD94 17-Jul-17 3:24am View    
Thanks for your time. I've updated my answer to reflect on adding in a dispatcher, however unfortunately the TextBlocks are still not updating, frustrating really. I've even added in a Button that is bound to a command that sets FirstName = "Test". This does actually update the TextBlock so I can only see the problem is with the messenger.
DRD94 8-Mar-17 5:35am View    
There seems to be scarce information on either solution. Nothing I have found so far has worked, hence this question.