FrameworkContentElement.FindName(String) FrameworkContentElement.FindName(String) FrameworkContentElement.FindName(String) FrameworkContentElement.FindName(String) Method

定義

指定した識別名を持つ要素を検索します。Finds an element that has the provided identifier name.

public:
 System::Object ^ FindName(System::String ^ name);
public object FindName (string name);
member this.FindName : string -> obj
Public Function FindName (name As String) As Object

パラメーター

name
String String String String

検索対象の要素の名前。Name of the element to search for.

戻り値

要求された要素。The requested element. 一致する要素が見つからなかった場合は null になります。May be null if no matching element was found.

次の例では、内で参照先の名前によって検出された要素のプロパティを設定FlowDocumentページ。The following example sets a property on an element found by name within a referenced FlowDocument on a page.

void HighlightParagraph(string paraName)
{
    try
    {
        Paragraph wantedNode = (Paragraph)myflowdocument.FindName(paraName);
        if (wantedNode != null)
        {
            wantedNode.Background = Brushes.LightYellow;
        }
    }
    catch { }//handle paragraph not found in UI }
}
Private Sub HighlightParagraph(ByVal paraName As String)
	Try
		Dim wantedNode As Paragraph = CType(myflowdocument.FindName(paraName), Paragraph)
		If wantedNode IsNot Nothing Then
			wantedNode.Background = Brushes.LightYellow
		End If
	Catch 'handle paragraph not found in UI }
	End Try
End Sub

注釈

この要素に子要素がある場合は、要求された要素をという名前の再帰的には、すべて検索が、これらの子要素。If this element has child elements, these child elements are all searched recursively for the requested named element.

適用対象