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 use a temp directory that will be unique to this build.
I want to have generalised email templates. Currently I have multiple email templates with
I'm working on a project in C# w/ XNA, and I want to reorganize
I want the messagebox to only show if the number is equal to 0.
I want to get the header of a selected tab-item of a tab-control and
Every time that I want to do a Layout, I'm getting a black layout
If all tables I want to delete from have the column gamer_id can i
Let say I have the following desire, to simplify the IConvertible's to allow me
I have a snippet to create a 'Like' button for our news site: <iframe
I am using a 3rd-party rotator object, which is providing a smooth, random rotation

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.