TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Imtiaz Ali
NA
8
2.4k
Listview WPF (winform to wpf)
Sep 23 2016 1:54 AM
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 xmal
ListView x:Name="lv1" HorizontalAlignment="Left" Height="172" Margin="10,76,0,0" VerticalAlignment="Top" Width="594">
<ListView.View>
<GridView>
<GridViewColumn Header="ssid" Width="100"/>
<GridViewColumn Header="Signal" Width="100"/>
<GridViewColumn Header="type" Width="100"/>
</GridView>
</ListView.View>
</ListView>
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?)
Reply
Answers (
3
)
change tableadapter connection string at runtime
How to control flickering problem in C# windows application