Unfortunately, there's way to do this as simple as accessing a named object. Assuming that you're using binding to fill this Data Template, one option would be to iterate through the child objects of the parent control and check the text fields against a known value. Slightly cleaner might be to make use of the Tag property (which can be bound to any object) and make comparisons that way.
Another option (the one I use most frequently for things like this) would be to add a property to the object that you're binding to and bind that property to visibility (using a converter if necessary). For example, if you're currently binding to an ObservableCollection< string >, change the binding to an ObservableCollection< StringWithVisibility > where StringWithVisibility looks like:
public class StringWithVisibility
{
public string Text {get; set;}
public bool IsVisible {get; set;}
}
And then your template looks like:
<DataTemplate>
<StackPanel x:Name="stackPanelItems" Orientation="Horizontal">
<TextBlock Text="{Binding Text}" Visibility={Binding IsVisible, Converter={StaticResource BoolVisibilityConverter}} />
</StackPanel>
</DataTemplate>
And you have created the appropriate IValueConverter as a resource. If you're not familiar with converters, the docs are here: http://msdn.microsoft.com/en-us/library/system.windows.data.ivalueconverter(VS.95).aspx