Click here to Skip to main content
15,885,141 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i am trying wpf for the first time and with lot of research and help from Pete O'Hanlon. i was able to come to a certain point. but after binding with the class and all i am still not able to get the value to the label when it changes in the code of class

I am using VS2008 framework 3.5

XML
<Window x:Class="Window1"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="Avenet Prduct Description Extractor" Height="396.627" Width="588.123" removed="AliceBlue" >
    <Grid Height="341.077" Width="567.721" removed="AliceBlue">

        
        <StackPanel Margin="170.225,226.418,3.143,0" Name="StackPanel1" Height="97.994" VerticalAlignment="Top">
            <Label Height="30.906" Name="lblCrntSt1" Content="{Binding PrdFrstName}" Width="161" BorderThickness="2" BorderBrush="AliceBlue" Background="Red" Foreground="White" FontSize="13"></Label>
            <Label Height="33.633" Name="lblcrntst2" Content="{Binding prdScndName}" Width="161" BorderThickness="2" BorderBrush="AliceBlue" Background="Red" Foreground="White" FontSize="13"></Label>
            <Label Height="29.997" Name="lblcrntst3" Content="{Binding prdLastName}" Width="161" BorderThickness="2" BorderBrush="AliceBlue" Background="Red" Foreground="White" FontSize="13">Label State3</Label>
        </StackPanel>
        <StackPanel Margin="0,62.216,73.348,0" Name="StackPanel2" Height="94.816" VerticalAlignment="Top" removed="Honeydew" HorizontalAlignment="Right" Width="144.43">
            <StackPanel.Resources>
                <Style TargetType="Button">
                    <Setter Property="Margin" Value="0,07,0,0"></Setter>

                </Style>

            </StackPanel.Resources>
            
        
    </Grid>
</Window>



here is the window class where it is initialized

VB
Class Window1

    Dim clsIniti As New ExtractDetails

Public Sub New()

        ' This call is required by the Windows Form Designer.
        InitializeComponent()
        'clsIniti = New ExtractDetails
        Me.DataContext = clsIniti

        ' Add any initialization after the InitializeComponent() call.

    End Sub
end class




here is my class where it all happens. this is a separate class

VB
Public Class ExtractDetails
    Inherits UserControl
    Implements System.ComponentModel.INotifyPropertyChanged

    Public Event PropertyChanged As PropertyChangedEventHandler Implements INotifyPropertyChanged.PropertyChanged
    
    Private _prdFrstName, _prdScndName, _prdLastName As String
    Private lstPdfDwn As List(Of String) = New List(Of String)
    Dim intPgeLop As Integer = 0
    Dim blnPgeLod As Boolean


#Region "Properties for Passing back the values to form"
     Public Property PrdFrstName() As String
        Get
            Return _prdFrstName
        End Get
        Set(ByVal value As String)
            If _prdFrstName <> value Then
                _prdFrstName = value
                OnPropertyChanged("PrdFrstName")
            End If
        End Set
    End Property



    Public Property prdScndName() As String
        Get
            Return _prdScndName
        End Get
        Set(ByVal value As String)
            If _prdScndName <> value Then
                _prdScndName = value
                OnPropertyChanged("prdScndName")
            End If
        End Set
    End Property

    Public Property prdLastName() As String
        Get
            Return _prdLastName
        End Get
        Set(ByVal value As String)
            If _prdLastName <> value Then
                _prdLastName = value
                OnPropertyChanged("prdLastName")
            End If
        End Set
    End Property

	Private Sub OnPropertyChanged(ByVal propertyName As String)
        	RaiseEvent PropertyChanged(Me, New PropertyChangedEventArgs(propertyName))
    	End Sub

#End Region


 Public Sub suMainStrt(ByVal strFilePath As String)
		PrdFrstName= "http://www.lg.com"

                Call extract(webBrwFrst, strComurl(1))
                webBrwFrst.Dispose()
                webBrwFrst = Nothing
end sub

End Class



I m getting confused. please correct me. i am totally new to this WPF and MVVM
the extract function is working and i am getting all the details and every thing
i created this in windows forms and it is working great.

this is edited coed and i might have missed adding something. but i am not getting any errors as of such in my VS2008
Posted
Updated 22-Feb-13 0:35am
v2
Comments
Manu_vish 25-Feb-13 0:42am    
i am doing all correct or nothing correct??? i tried all googled things. but nothing is making it reflect that change in url. does any one have any idea

1 solution

i did a silly mistake of creating that class objects twice and accessing object with no values in the properties. big blunder.
so created only one instance and it is working like charm.
 
Share this answer
 

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