Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to make an an item in a Listbox visibile but unclickable
    primarykey
    data
    text
    <p>I have Listbox which is bound to my view model. This view model has a property </p> <p>I need the item to be visible but unclickable with the change of this field. Any suggestion anyone</p> <pre><code>public interface IRegionAreaDM { /// &lt;summary&gt; /// Name of the Focus Area /// &lt;/summary&gt; string RegionAreaName { get; set; } /// &lt;summary&gt; /// Determines if the Tab is currently selected. /// &lt;/summary&gt; bool IsSelected { get; set; } /// &lt;summary&gt; /// Determines if the Tab is linked to any other Tab /// &lt;/summary&gt; bool IsLinked { get; set; } /// &lt;summary&gt; /// /// &lt;/summary&gt; bool IsActive { get; set; } </code></pre> <p>}</p> <p>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</p> <pre><code> &lt;Style TargetType="ListBoxItem"&gt; &lt;Setter Property="Template"&gt; &lt;Setter.Value&gt; &lt;ControlTemplate TargetType="ListBoxItem"&gt; &lt;Border x:Name="Bd" HorizontalAlignment="Stretch" Background="#00D05252" BorderThickness="0,1" SnapsToDevicePixels="true"&gt; &lt;!-- &lt;StackPanel x:Name="ParamterRoot" Orientation="Horizontal"&gt; --&gt; &lt;Grid x:Name="ParamterRoot"&gt; &lt;Grid.ColumnDefinitions&gt; &lt;ColumnDefinition Width="Auto" /&gt; &lt;ColumnDefinition Width="*" /&gt; &lt;ColumnDefinition Width="Auto" /&gt; &lt;/Grid.ColumnDefinitions&gt; &lt;CheckBox x:Name="ParametersCheckbox" Grid.Column="0" Margin="10,0,0,0" VerticalAlignment="Center" IsChecked="{Binding IsSelected}" &lt;TextBlock Grid.Column="1" Width="Auto" Margin="20,7.5,0,7.5" Text="{Binding RegionAreaName}" TextTrimming="CharacterEllipsis"&gt; &lt;TextBlock.Style&gt; &lt;Style TargetType="{x:Type TextBlock}"&gt; &lt;Style.Triggers&gt; &lt;Trigger Property="IsMouseDirectlyOver" Value="True"&gt; &lt;Setter Property="Cursor" Value="Hand" /&gt; &lt;/Trigger&gt; &lt;/Style.Triggers&gt; &lt;/Style&gt; &lt;/TextBlock.Style&gt; &lt;/TextBlock&gt; &lt;/Grid&gt; &lt;!-- &lt;/StackPanel&gt; --&gt; &lt;/Border&gt; &lt;ControlTemplate.Triggers&gt; &lt;Trigger Property="IsMouseOver" Value="true"&gt; &lt;Setter TargetName="Bd" Property="Background" Value="#FFC10000" /&gt; &lt;/Trigger&gt; &lt;Trigger Property="IsSelected" Value="true"&gt; &lt;Setter TargetName="Bd" Property="Background" Value="#FFC10000" /&gt; &lt;/Trigger&gt; &lt;DataTrigger Binding="{Binding IsActive}" Value="False"&gt; &lt;Setter Property="IsEnabled" Value="False" /&gt; &lt;/DataTrigger&gt; &lt;/ControlTemplate.Triggers&gt; &lt;/ControlTemplate&gt; &lt;/Setter.Value&gt; &lt;/Setter&gt; &lt;/Style&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload