Note that there are some explanatory texts on larger screens.

plurals
  1. POCheckBox state of a CellTemplate in ListView
    primarykey
    data
    text
    <p>i am trying to use styles to prevent from repeting code, by putting them in a Resource Disctionary.</p> <p>My question is, when we have a GridViewColumn in a ListView, which one of the columns have a DataTemplate, and in that DataTemplate we have the CellTemplate with only a CheckBox, can we bind the CheckBox state when the DataTemplete is in a ResourceDictionary?</p> <p>What i have is this in my XAML:</p> <pre><code>&lt;ListView Name="listView"&gt; &lt;ListView.View&gt; &lt;GridView AllowsColumnReorder="False"&gt; &lt;GridViewColumn DisplayMemberPath="{Binding [1]}"/&gt; &lt;GridViewColumn DisplayMemberPath="{Binding [2]}"/&gt; &lt;GridViewColumn DisplayMemberPath="{Binding [4]}"/&gt; &lt;GridViewColumn DisplayMemberPath="{Binding [5]}"/&gt; &lt;GridViewColumn DisplayMemberPath="{Binding [6]}"/&gt; &lt;GridViewColumn DisplayMemberPath="{Binding [7]}"/&gt; &lt;GridViewColumn&gt; &lt;GridViewColumn.CellTemplate&gt; &lt;DataTemplate&gt; &lt;CheckBox IsThreeState="False" IsChecked="{Binding [8]}" Unchecked="CheckBox_Changed" Checked="CheckBox_Changed"/&gt; &lt;/DataTemplate&gt; &lt;/GridViewColumn.CellTemplate&gt; &lt;/GridViewColumn&gt; &lt;/GridView&gt; &lt;/ListView.View&gt; &lt;/ListView&gt; </code></pre> <p>And i am trying to do something like this in the Resource Dictionary:</p> <pre><code>&lt;DataTemplate x:Key="ListViewCheckboxCell"&gt; &lt;StackPanel&gt; &lt;CheckBox IsThreeState="False" IsChecked="Make reference"/&gt; &lt;/StackPanel&gt; &lt;/DataTemplate&gt; </code></pre> <p>And the values in that column is always a bool.</p> <p>Thanks in advance!</p>
    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.
    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