FrameworkContentElement.FindName(String) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
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
Parameters
- name
- String
Name of the element to search for.
Returns
The requested element. May be null
if no matching element was found.
Examples
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
Remarks
If this element has child elements, these child elements are all searched recursively for the requested named element.
Applies to
.NET
피드백
https://aka.ms/ContentUserFeedback
출시 예정: 2024년 내내 콘텐츠에 대한 피드백 메커니즘으로 GitHub 문제를 단계적으로 폐지하고 이를 새로운 피드백 시스템으로 바꿀 예정입니다. 자세한 내용은 다음을 참조하세요.다음에 대한 사용자 의견 제출 및 보기