Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; Translation_Entry has a deprecated constructor in /home/sheltonr/public_html/wp-includes/pomo/entry.php on line 14

Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; POMO_Reader has a deprecated constructor in /home/sheltonr/public_html/wp-includes/pomo/streams.php on line 12

Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; POMO_FileReader has a deprecated constructor in /home/sheltonr/public_html/wp-includes/pomo/streams.php on line 120

Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; POMO_StringReader has a deprecated constructor in /home/sheltonr/public_html/wp-includes/pomo/streams.php on line 175

Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; POMO_CachedFileReader has a deprecated constructor in /home/sheltonr/public_html/wp-includes/pomo/streams.php on line 221

Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; POMO_CachedIntFileReader has a deprecated constructor in /home/sheltonr/public_html/wp-includes/pomo/streams.php on line 236

Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; WP_Widget_Factory has a deprecated constructor in /home/sheltonr/public_html/wp-includes/widgets.php on line 544
WPF Data Bindings - Software, Website Design, Cordova/Memphis TN

WPF Data Bindings

WPF_LISTVIEW

 

Playing with some new toys today — I am trying to use WPF anywhere I would otherwise use the WinForms technology.

So I am supposed to check diskspace on some remote hosts (Windows Server 2003) and I don’t want to constantly login;  Whatever, it’s an excuse to learn something.

So I want to display free space percents of “mapped drives” when I click on this program.

The object I use to display is a  ListView.  In WPF, a listview is slightly different (from WinForms), but it’s versatile.

I found some older examples that set the display values as a “column” and in WPF you can bind the columns to class properties.

So, in the XAML, you just say what property binds to the column using “DisplayMemberBinding” and the squiggly brackets…:

<ListView
 SelectionMode=“Single”
 x:Name=“lstDrives”
 Grid.Row=“2” >
<ListView.View>
<GridView>
<GridViewColumn Header=“Drive” DisplayMemberBinding=”{Binding DriveLetter}/>
<GridViewColumn Header=“Free Space” DisplayMemberBinding=”{Binding DiskFreeSpace}/>
<GridViewColumn Header=“Size” DisplayMemberBinding=”{Binding Size}/>
<GridViewColumn Header=“Percent Free” DisplayMemberBinding=”{Binding PercentFree}/>
<GridViewColumn Header=“UNC Name” DisplayMemberBinding=”{Binding UNCName}/>
<GridViewColumn Header=“Mapped” DisplayMemberBinding=”{Binding Mapped}/>
</GridView>
</ListView.View>
</ListView>

Then, the ListView populates with the values.

Proactive technologist.

Posted in New, WPF

What do you think?