Greetings,
i made wifi scanner application in c#(winform) which is working perfectly. Now, i am trying to make the same application in c# (WPF) but i am getting errors in listview with this code...
private void scan_Click(object sender, RoutedEventArgs e)
{
WlanClient client = new WlanClient();
foreach (WlanClient.WlanInterface wlanInterface in client.Interfaces)
{
Wlan.WlanAvailableNetwork[] networks = wlanInterface.GetAvailableNetworkList(0);
foreach (Wlan.WlanAvailableNetwork network in networks)
{
Wlan.Dot11Ssid ssid = network.dot11Ssid;
string networkname = Encoding.ASCII.GetString(ssid.SSID, 0, (int)ssid.SSIDLength);
System.Windows.Controls.ListViewItem item = new System.Windows.Controls.ListViewItem(networkname);
item.SubItems(network.dot11DefaultCipherAlgorithm.ToString());
item.SubItems.Add(network.wlanSignalQuality + "%");
lv1.Items.Add(item);
}
}
}
and xmalListView x:Name="lv1" HorizontalAlignment="Left" Height="172" Margin="10,76,0,0" VerticalAlignment="Top" Width="594">
Error are :
Error 1 'System.Windows.Controls.ListViewItem' does not contain a constructor that takes 1 arguments
Error 2 'System.Windows.Controls.ListViewItem' does not contain a definition for 'SubItems' and no extension method 'SubItems' accepting a first argument of type 'System.Windows.Controls.ListViewItem' could be found (are you missing a using directive or an assembly reference?)
3 Replies
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Piyush PansuriyaPosted Sep 23, 2016, 4:14 AM
Imtiaz AliPosted Sep 23, 2016, 3:56 AM
Piyush PansuriyaPosted Sep 23, 2016, 3:04 AM