
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I am trying from several days to try to make it work but I could not.. Please help.
My xaml
<UserControl x:Class="PN_NO"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
>
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:SchneiderMacros"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="300">
<UserControl.DataContext >
<local:mainviewmodel ></local:mainviewmodel>
</UserControl.DataContext>
<Grid Background="#FF2D2D30">
<StackPanel >
<TextBox Height=" 30" Text="{Binding device}" Margin=" 10"></TextBox>
</StackPanel>
</Grid> </UserControl>
My view class
Public Class PNWPFPalette
Public devicelocaton As String
Shared _PS1 As PaletteSet = Nothing
Public Sub ShowPNWPFPalette()
If _PS1 Is Nothing Then
_PS1 = New PaletteSet("Modify Attributes")
_PS1.Size = New Size(400, 600)
_PS1.DockEnabled = DirectCast(CInt(DockSides.Left) + CInt(DockSides.Right), DockSides)
Dim uc1 As New PN_NO
'_PS1.AddVisual("Update PN", uc1)
Dim host As ElementHost = New ElementHost
host.AutoSize = True
host.Dock = DockStyle.Fill
host.Child = uc1
_PS1.Add("Modify PN", host)
Dim uc2 As New PN_NO
Dim host1 As ElementHost = New ElementHost
host1.AutoSize = True
host1.Dock = DockStyle.Fill
host1.Child = uc2
_PS1.Add("Modify PN2", host1)
End If
_PS1.KeepFocus = True
_PS1.Visible = True
End Sub
Public Function findattributes()
Dim DL as string = "Pankaj"
Return DL
End Function
End Class
My Viewmodel class
Public Class mainviewmodel
Implements INotifyPropertyChanged
Public Property device As String
Get
Return _device
End Get
Set(value As String)
_device = value
OnPropertyChange("device")
End Set
End Property
Private _device As String
Protected Sub OnPropertyChange(name As String)
RaiseEvent PropertyChanged(Me, New PropertyChangedEventArgs(name))
End Sub
Public Event PropertyChanged As PropertyChangedEventHandler Implements INotifyPropertyChanged.PropertyChanged
End Class
Class where I am running my commands
Public class mycommands
<CommandMethod("addPNPalette", CommandFlags.UsePickSet)>
Public Sub PNPalette()
Dim addpn As New PNWPFPalette
Dim viewmodel As New mainviewmodel
addpn.ShowPNWPFPalette()
Dim DL As String = addpn.findattributes()
viewmodel.device = "Schneider"
End Sub
End Class
Afte running command textbox remains blank... Please help.......
Solved! Go to Solution.