Hi! I have a problem. After Click MenuItem header: "System.XML.XMLElement".
Can someone please tell me what I'm doing wrong?
IpLisr.xml
<?xml version="1.0" encoding="utf-8" ?>
<IPList>
<header Name="1" Click="1" Tag="1">192.168.0.100</header>
<header Name="2" Click="2">192.168.0.101</header>
<header Name="3" Click="3">192.168.0.102</header>
</IPList>
list.xaml
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<XmlDataProvider x:Key="XMLMenu" Source="IPList.xml" XPath="IPList/header"/>
</ResourceDictionary>
XAML:
<MenuItem Header="IP" DataContext="{StaticResource XMLMenu}" ItemsSource="{Binding}" Click="MenuItem_Click_IP"/>
*.cs
private void MenuItem_Click_IP(object sender, RoutedEventArgs e)
{
MenuItem obMenuItem = e.OriginalSource as MenuItem;
MessageBox.Show(String.Format("{0} just said Hi!", obMenuItem.Header));
//Need header of IPList.xml. How get that?
}