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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T09:17:26+00:00 2026-06-03T09:17:26+00:00

I have Listbox which is bound to my view model. This view model has

  • 0

I have Listbox which is bound to my view model. This view model has a property

I need the item to be visible but unclickable with the change of this field. Any suggestion anyone

public interface IRegionAreaDM 
{

    /// <summary>
    /// Name of the Focus Area
    /// </summary>
    string RegionAreaName { get; set; }

    /// <summary>
    /// Determines if the Tab is currently selected.
    /// </summary>
    bool IsSelected { get; set; }

    /// <summary>
    /// Determines if the Tab is linked to any other Tab
    /// </summary>
    bool IsLinked { get; set; }

    /// <summary>
    ///
    /// </summary>
    bool IsActive { get; set; }

}

Each item is connected to an item in the XAML eg Name with a Textbox . IsSelected with a CheckBox and IsActive is to make the ListBoxItems Enabled/Disabled depending on the logic
and my Xaml style loooks something like this

 <Style TargetType="ListBoxItem">
      <Setter Property="Template">
        <Setter.Value>
          <ControlTemplate TargetType="ListBoxItem">
            <Border x:Name="Bd" HorizontalAlignment="Stretch" Background="#00D05252"
                    BorderThickness="0,1" SnapsToDevicePixels="true">
              <!--  <StackPanel x:Name="ParamterRoot" Orientation="Horizontal">  -->
              <Grid x:Name="ParamterRoot">
                <Grid.ColumnDefinitions>
                  <ColumnDefinition Width="Auto" />
                  <ColumnDefinition Width="*" />
                  <ColumnDefinition Width="Auto" />
                </Grid.ColumnDefinitions>
                <CheckBox x:Name="ParametersCheckbox" Grid.Column="0" Margin="10,0,0,0"
                          VerticalAlignment="Center" IsChecked="{Binding IsSelected}"
                <TextBlock Grid.Column="1" Width="Auto" Margin="20,7.5,0,7.5"
                           Text="{Binding RegionAreaName}" TextTrimming="CharacterEllipsis">
                  <TextBlock.Style>
                    <Style TargetType="{x:Type TextBlock}">
                      <Style.Triggers>
                        <Trigger Property="IsMouseDirectlyOver" Value="True">
                          <Setter Property="Cursor" Value="Hand" />
                        </Trigger>
                      </Style.Triggers>
                    </Style>
                  </TextBlock.Style>
                </TextBlock>                   
              </Grid>
              <!--  </StackPanel>  -->
            </Border>
            <ControlTemplate.Triggers>
              <Trigger Property="IsMouseOver" Value="true">
                <Setter TargetName="Bd" Property="Background" Value="#FFC10000" />
              </Trigger>
              <Trigger Property="IsSelected" Value="true">
                <Setter TargetName="Bd" Property="Background" Value="#FFC10000" />
              </Trigger>
 <DataTrigger Binding="{Binding IsActive}" Value="False">
                                    <Setter Property="IsEnabled" Value="False" />
                                </DataTrigger>

            </ControlTemplate.Triggers>
          </ControlTemplate>
        </Setter.Value>
      </Setter>
    </Style>
  • 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-06-03T09:17:28+00:00Added an answer on June 3, 2026 at 9:17 am

    enter image description here

    Code Behind: (you are using MVVM so you will adjust this code a little but to fit to your pattern)

    public partial class Window1 : Window
    {
        public List<T> Items { get; set; }
        public Window1()
        {
            Items = new List<T>
                        {
                            new T{  Id = 1,Name = "qwe",IsEnabled = true},
                            new T{  Id = 2,Name = "asd",IsEnabled = false},
                            new T{  Id = 3,Name = "zxc",IsEnabled = true},
                            new T{  Id = 4,Name = "rty",IsEnabled = false},
                        };
            InitializeComponent();            
            DataContext = this;
        }
    }
    
    public class T
    {
        public int Id { get; set; }
        public String Name { get; set; }
        public bool IsEnabled { get; set; }
    }
    

    XAML:

    <ListBox Name="listBox1" ItemsSource="{Binding Items}" DisplayMemberPath="Name">
        <ListBox.ItemContainerStyle>
            <Style TargetType="{x:Type ListBoxItem}">
                <Setter Property="IsEnabled" Value="{Binding IsEnabled,Mode=TwoWay}" />
            </Style>
        </ListBox.ItemContainerStyle>
    </ListBox>
    

    Hope This Help

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

Sidebar

Related Questions

I have a standard Listbox which is bound to a property in my viewmodel
[Original] I have a ListBox which has its ItemsSource (this is done in the
I have an ItemsContol bound to a Country model - which look like this.
I have this ListBox which is bound to an ObservableCollection. Each object in the
So, I have a ListBox which is bound to a list of business objects,
I have a Listbox DataTemplate which looks like this <DataTemplate> <StackPanel Margin=0,24,0,24> <StackPanel toolkit:TiltEffect.IsTiltEnabled=true>
I have a ListBox which is bound to a collection. When I add an
I have a ListBox to which I bound a sorted list of strings. I
I have a listbox that is bound to a List<T> -- this is working
Suppose I have a ListBox which is bound to a collection of Foo objects,

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.