Yes I still use Static(C#) or Shared(VB) methods in my WPF applications to do some of these tasks. I use a XAML Method SetValue(dependancyproperty,Object) in side of generic methods to switch controls enabled/visible properties on/off on mass. This allows you to walk up and down the XAML visual tree to do things. I've found WPF methods to do these tasks contain less code that the VB6 way of doing things and much simpler codebase than WindowsForms.
VB.net WPF 3.5/4.0 Example - Control Visibility:
''' <summary>
''' Use the Tag property to indicate if the controls visibility should be set or not.
''' </summary>
Shared Function ControlVisibilityByTag(ByVal element As Visual, ByVal tagContents As String, ByVal controlVisibility As Visibility) As Boolean
Dim ControlList As List(Of Visual)
ControlList = GetControlsByTag(element, tagContents)
For myLoop As Integer = 0 To ControlList.Count - 1
' LL: SetValue is a cool alternative to strongly typing controls and setting a controls visibility. Thanks to Linda Lui at Microsoft
ControlList.Item(myLoop).SetValue(Control.VisibilityProperty, controlVisibility)
Next
Return ControlList.Count > 0
End Function
Public Shared Function GetControlsByTag(ByVal element As Visual, ByVal tagContents As String) As List(Of Visual)
If element Is Nothing Then
Throw New ArgumentNullException([String].Format("Element {0} is null !", element.ToString()))
End If
If _NamedControllist Is Nothing Then
_NamedControllist = New List(Of Visual)
Else
_NamedControllist.Clear()
End If
GetNestedControlsListByTag(element, 0, tagContents)
Return _NamedControllist
End Function
Private Shared Sub GetNestedControlsListByTag(ByVal control As Visual, ByVal level As Integer, ByVal tagContents As String)
Dim ChildNumber As Integer = VisualTreeHelper.GetChildrenCount(control)
For i As Integer = 0 To ChildNumber - 1
Dim v As Visual = DirectCast(VisualTreeHelper.GetChild(control, i), Visual)
' LL: GetValue is a cool alternative to strongly typing controls to read a standard control property value. Thanks to Linda Lui at Microsoft
If Not IsNothing(v.GetValue(FrameworkContentElement.TagProperty)) AndAlso v.GetValue(FrameworkContentElement.TagProperty).ToString() = tagContents Then
_NamedControllist.Add(v)
End If
If VisualTreeHelper.GetChildrenCount(v) > 0 Then
GetNestedControlsListByTag(v, level + 1, tagContents)
End If
Next
End Sub
Frameworks like CSLA also provide some inbuild control/menu functionality to enable and disable menus/buttons based on the state of the Classes that are bound via XAML databinding. This is particularly usefull for CRUD operations and record navigation. However, even using a framework, I've found that I also need some generic find controls and change control property methods in my WPF application and I'm happy to continue useing shared/static methods.