Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6015359
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T02:49:30+00:00 2026-05-23T02:49:30+00:00

<DataTemplate> <StackPanel Orientation=Vertical Name=AddressStackPanel > <ComboBox Name=ComboBox ItemsSource={Binding Path=MatchedAddressList} DisplayMemberPath=Address SelectedIndex=0 SelectionChanged=ComboBox_SelectionChanged/> <TextBlock Name=InputtedAddress

  • 0
<DataTemplate>
  <StackPanel Orientation="Vertical" Name="AddressStackPanel" >
    <ComboBox  Name="ComboBox" ItemsSource="{Binding Path=MatchedAddressList}" DisplayMemberPath="Address" SelectedIndex="0" SelectionChanged="ComboBox_SelectionChanged"/>
    <TextBlock Name="InputtedAddress" Text="{Binding Path=InputtedAddress}"  Foreground={Hopefully pass the UI element to the dataconverter }  />
  </StackPanel>
</DataTemplate>

The ComboBox has addresses matched by from a geodatabase with the highest scoring value selected. The Textblock has the user-inputted address that was used for matching. If the address is the same, I want the foreground to be Green, otherwise Red.

I thought maybe I could pass the entire TextBlock into the dataconverter, get its Parent StackPanel, get child 0, cast to a Combobox get the 0th element and compare, and then return red or green. Is this do-able?

Otherwise I think I have to traverse the visual tree which is just as ugly i think

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T02:49:31+00:00Added an answer on May 23, 2026 at 2:49 am
    <DataTemplate>
        <StackPanel Orientation="Vertical" Name="AddressStackPanel" >
            <ComboBox  Name="ComboBox" 
                       ItemsSource="{Binding Path=MatchedAddressList}" 
                       DisplayMemberPath="Address" SelectedIndex="0" 
                       SelectionChanged="ComboBox_SelectionChanged"/>
            <TextBlock Name="InputtedAddress" Text="{Binding Path=InputtedAddress}"  
                       Foreground={"Binding RelativeSource={x:Static RelativeSource.Self}, 
                                    Converter={x:StaticResource myConverter}}" />
       </StackPanel>
    </DataTemplate> 
    

    Yes. See msdn article

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here is the XAML: <ListBox ItemsSource={Binding Documents} BorderBrush={x:Null}> <ListBox.ItemTemplate> <DataTemplate> <StackPanel Orientation=Vertical> <TextBlock Text={Binding
My xaml ... <ListBox Margin=6,35,6,6 Name=lbLayers SelectionMode=Extended > <ListBox.ItemTemplate> <DataTemplate> <StackPanel Orientation=Vertical> <TextBlock Text={Binding
People use frequently something like: <ListBox ItemsSource={Binding ElementName=thisControl, Path=ListIndexes}> <ListBox.ItemTemplate> <DataTemplate> <StackPanel> <Label Content={Binding
I have a databound and itemtemplated ListBox: <ListBox x:Name=lbLista ScrollViewer.VerticalScrollBarVisibility=Visible> <ListBox.ItemTemplate> <DataTemplate> <StackPanel Orientation=Horizontal>
I have the following structure in XAML: <Grid> <ItemsControl x:Name=Items ItemsSource={Binding Path=Pages} Grid.Row=0 Grid.Column=0>
I have xaml that lookes like this <ListBox> <ListBox.ItemTemplate> <DataTemplate> <StackPanel> <TextBlock Text={Binding Name}
<Border CornerRadius=2,2,2,2 BorderThickness=1 BorderBrush=LightSkyBlue Margin=5,2,2,2 x:Name=PersonBorder Visibility=Collapsed> <StackPanel Orientation=Vertical> <ListBox Name=personListBoxTest BorderThickness=0 ScrollViewer.HorizontalScrollBarVisibility=Hidden ScrollViewer.VerticalScrollBarVisibility=Auto
I have a combo box with the following DataTemplate: <DataTemplate x:Key=ComboBoxDataTemplate> <StackPanel> <TextBlock Text={Binding
I have this: <ListBox x:Name=PART_lstAttributes Grid.Row=1 Style={StaticResource GlossyBlackListBox}> <ListBox.ItemTemplate> <DataTemplate> <StackPanel> <TextBlock x:Name=txtAttributeName Text={Binding
I have the following DataTemplate : <DataTemplate x:Key=ColoringLabels> <TextBlock Padding=0 Margin=0 Name=Username Text={Binding Username}

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.