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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T12:35:36+00:00 2026-05-21T12:35:36+00:00

I have a ListView with a few GridViewColumn . One of the columns I

  • 0

I have a ListView with a few GridViewColumn. One of the columns I am showing the visibility of layers and I binded the icon and the opacity, but I am not sure how to bind it to a property called IsVisible so that whenever an item is clicked in that column, it will toggle the IsVisible boolean value.

Any ideas on how to do this?

<GridViewColumn Width="20">
    <GridViewColumnHeader Content="X" />
    <GridViewColumn.CellTemplate>
        <DataTemplate>
            <StackPanel Orientation="Horizontal">
                <Image Width="18"
                Height="18"
                Source="{Binding VisibleIcon}"
                        Opacity="{Binding VisibleOpacity}"
                        />
            </StackPanel>
        </DataTemplate>
    </GridViewColumn.CellTemplate>
</GridViewColumn>

Additionally, VisibleOpacity defines the Opacity for the icon but I feel like this is not a good way to do it because I had to create this property solely for this purpose. Is there a way to do this inline in xaml? Maybe like:

Opacity = (this.IsVisible) ? 1 : 0.5;
  • 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-21T12:35:36+00:00Added an answer on May 21, 2026 at 12:35 pm

    EDIT : ok, so I think this should be good now..

    Still assuming that your collection is a collection of :

    public class Effect : INotifyPropertychanged
    {
        //Some properties
    
    
        private bool isVisible;
        public bool IsVisible
        {
            get { return isVisible;}
            set { isVisible=value;//plus raise propertychanged notification}
        }      
    }
    

    then I think the simplest way to propagate the image click both to your code property and to the image opacity is to wrap your icon in a toggle button. Here is a code I have used and tested. Just replace the values by yours and put this in your data template, it should work fine this time :

    <ToggleButton x:Name="tgBtn" Height="20" Width="20" IsChecked="{Binding IsVisible}" 
                  BorderThickness="0" Background="Transparent" >
        <ToggleButton.Style>
            <Style TargetType="{x:Type ToggleButton}">
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate>
                            <Image Width="18"
                               Height="18"                 
                               Source="C:\USERS\thumbnail.jpeg">
                                <Image.Style>
                                    <Style TargetType="{x:Type Image}">
                                        <Setter Property="Opacity" Value="1"/>
                                        <Style.Triggers>
                                            <DataTrigger Binding="{Binding ElementName=tgBtn, Path=IsChecked}" Value="false">
                                                <Setter Property="Opacity" Value="0.5"/>
                                            </DataTrigger>
                                        </Style.Triggers>
                                    </Style>
                                </Image.Style>
                            </Image>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>
        </ToggleButton.Style>
    </ToggleButton>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a DataSet that contains a few columns. One of these columns is
I have simple ListView with few columns and it's populated with data with background
I have listview having customized some textview and one imageview. When I long click
I have ListView that uses a GridView to display several columns of data. Two
I have trying to solve this problem from last few days but no success.
I have a ListView with few elements, each item contains two buttons with a
How can I recreate listView? I have listView with items containing few TextViews and
i have a ListView (lvProperties) whose adapter is a custom ListAdapter (not an ArrayAdapter).
I have a ListView that displays a few TextBoxes . For each TextBox ,
I have a page with few listview and a few datalist, which are bound

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.