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 525273
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T08:39:15+00:00 2026-05-13T08:39:15+00:00

I want to do this in XAML with a trigger, how do I do

  • 0

I want to do this in XAML with a trigger, how do I do it?

    If ListBox1.SelectedIndex > -1 Then
        Border1.Visibility = Windows.Visibility.Visible
    Else
        Border1.Visibility = Windows.Visibility.Hidden
    End If

This XAML code does NOT work. SelectedIndex member is not valid because it does not have a qualifying type name.

            <ListBox.Triggers>
                <Trigger SourceName="ListBox1" Property="SelectedIndex" Value="False">
                    <Setter TargetName="Border1" Property="Visibilty" Value="Hidden" />
                </Trigger>
            </ListBox.Triggers>
  • 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-13T08:39:15+00:00Added an answer on May 13, 2026 at 8:39 am

    Can you show me how are you trying to do this in xaml?

    In case of this error message you need to mention type name also with the property inside trigger.

    <Trigger SourceName="ListBox1" Property="ComboBox.SelectedIndex" Value="-1">
        <Setter TargetName="Border1" Property="Border.Visibility" Value="Hidden" />
    </Trigger>
    

    Further, it seems that you are adding a Trigger in <ListBox.Triggers> collection, but you can only add EventTrigger in to this collection. So you need to declate a Style for your ListBox to add a Trigger for that and your Border element should be inside the ControlTemplate of ListBox, but in your case Border seems to be outside of ListBox, so declaring a style will not be a solution. Instead you should use Binding with SelectIndex property with the help of a ValueConverter(say IndexToVisibilityConverter). You need to define this converter in codebehind and add it in resources.

    <Border Visibility={Binding Path=SelectedIndex, ElementName=ListBox1, Converter={StaticResource IndexToVisibilityConverter}}/>
    

    Choice is totally on your requirements.

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

Sidebar

Related Questions

I want to do this in code, not with ALT+F1.
Let's say we have a XAML code like this: <Style TargetType={x:Type ListBoxItem}> <Setter Property=Template>
Here's a simple (hopefully) L10N question: Do all locales want this format: Sunday, Nov
I have this div: <div class=inauguration-image> I do not want this text to display,
My Invoice model has an address_id attribute, and I don't want this address_id to
I have a class that contains an array. I want this array to be
I want to do this: //*fu which returns all nodes whose name ends in
I want to do this so that I can say something like, svn mv
I want to download this open source application, and they are using Git. What
I want to do this: e.className = t; Where t is the name of

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.