Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

have TemplateColumn sort/filterable #55

Open
VisualAlf opened this issue Nov 1, 2024 · 1 comment
Open

have TemplateColumn sort/filterable #55

VisualAlf opened this issue Nov 1, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@VisualAlf
Copy link

Sometimes I have a request to mark a certain cell in some way. (For example show an overdue invoice date as red.) This seems not possible with the standard TableViewTextColumn, since we have no access to the underlying TextBlock/TextBox.

So the only way I see, is using the TableViewTemplateColumn for this purpose. (which works)

But the Template-Column can't be sorted or filtered.

I don't know why this is so. But it seems really easy to implement anyway.
I succeeded with making a TableViewTemplateColumnEX as a copy of TableViewTemplateColumn, but inherited from TableViewBoundColumn instead of TableViewColumn . Then I could write:

               <tv:TableViewTemplateColumnEX Header=... Width= ... Binding="{Binding PROP}">
                    <tv:TableViewTemplateColumnEX.CellTemplate>
                        <DataTemplate x:DataType="local:Item">
                            <TextBlock Text="{x:Bind PROP, Mode=OneWay}" 
                                       Foreground="{x:Bind hlp:Utils.GetForeground(State)}" />
                        </DataTemplate>
                    </tv:TableViewTemplateColumnEX.CellTemplate>
                </tv:TableViewTemplateColumnEX>

IMHO, having TemplateColumn sortable/filterable, should be default. We can always opt out by CanSort=False.
Also, getting rid of TableViewBoundColumn may simplify the code.

@VisualAlf VisualAlf added the enhancement New feature or request label Nov 1, 2024
@AlexanderBlackman
Copy link

I second the need for this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants