Hi everybody,
I'm not able to cath any ListBox selected item.
XAML definition:
<Popup x:Name="contextMenu" Opened="contextMenu_Opened" Closed="contextMenu_Closed"><Grid x:Name="GridMenu" Opacity="2"><Border><ListBox x:Name="contextListBox"
PreviewMouseLeftButtonUp="contextListBox_PreviewMouseLeftButtonUp"
Foreground="White" Background="White" /></Border></Grid></Popup>
Code-behind.
List class definition for the items:
Public Class Links Public _title As String Public _url As String Public Property url() As String Get Return _url End Get Set(ByVal value As String) _url = value End Set End Property Public Property title() As String Get Return _title End Get Set(ByVal value As String) _title = value End Set End Property Public Sub New(t As String) title = t End Sub End Class
Populating my list:
Public _links As New List(Of Links) _links.Add(New Links("Sustitución")) _links.Add(New Links("Daños fuertes")) _links.Add(New Links("Daños medios")) _links.Add(New Links("Daños leves")) _links.Add(New Links("Pintado superficial"))
Populating my ListBox:
contextListBox.Items.Clear() For Each l As Links In _links Dim hlb As New Hyperlink hlb.Inlines.Clear() hlb.Inlines.Add(l.title) contextListBox.Items.Add(hlb) Next
Here, my "s" variable has nothing as value..
PrivateSub contextListBox_PreviewMouseLeftButtonUp(senderAsObject, eAsMouseButtonEventArgs)
DimsAsString=Me.contextListBox.SelectedValue
EndSub
Nevertheless, contextListBox.Items.Count is equal to 5 in that point, that means is loaded...
What am I missing here?
ListBox is under one ContextMenu object.
Thanks a lot for your thoughts,
Primary platform is Windows 7 Ultimate 64 bit along with VS 2012/Sql2k8 for WPF/SilverLight projects.