Note that there are some explanatory texts on larger screens.

plurals
  1. POWPF ListView grouping by 2 columns but display only 1 group header
    primarykey
    data
    text
    <p>A ListView displays a collection of the following class:</p> <pre><code>public class Employee { private string _department; private string _manager; private string _name; private string _address; public string Department { get { return _department; } } public string Manager { get { return _manager; } } public string Name { get { return _name; } } public string Address { get { return _address; } } } </code></pre> <p>There is a 1-to-1 relation between Department and Manager, so any 2 rows with the same department will also have the same manager. </p> <p>I want to group by Department/Manager, with the group header showing "Department (Manager)". </p> <p>My CollectionViewSource looks like</p> <pre><code> &lt;CollectionViewSource x:Key="cvsEmployees" Source="{Binding Employees}"&gt; &lt;CollectionViewSource.GroupDescriptions&gt; &lt;PropertyGroupDescription PropertyName="Department" /&gt; &lt;PropertyGroupDescription PropertyName="Manager" /&gt; &lt;/CollectionViewSource.GroupDescriptions&gt; &lt;/CollectionViewSource&gt; </code></pre> <p>The plan is to not display the first level header (Department) and to somehow bind to both the Department (1st level) and the Manager (2nd level) from the 2nd level header. </p> <p>3 questions:</p> <ol> <li><p>To avoid displaying the 1st level header, I have an empty data template in the groupstyle:</p> <pre><code>&lt;GroupStyle&gt; &lt;GroupStyle.HeaderTemplate&gt; &lt;DataTemplate&gt; &lt;/DataTemplate&gt; &lt;/GroupStyle.HeaderTemplate&gt; &lt;/GroupStyle&gt; </code></pre> <p>This seems very clunky. Is there a more elegant way to skip a group header?</p></li> <li><p>How do I bind to the 1st grouping level property (Department) from the 2nd level header (Manager) to achieve the required "Department (Manager)" ?</p></li> <li><p>Is there a better way to do this than creating 2 grouping level?</p></li> </ol> <p>Thanks</p>
    singulars
    1. This table or related slice is empty.
    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.
 

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