question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Bug with DataTemplate

See original GitHub issue

Scope: It appears that when DataGridTemplateColumn.CellTemplate is in use the filter freezes and no longer functions.

<control:DataGridTemplateColumn Header="Collection" MinWidth="65" Width="10*" MaxWidth="150" IsColumnFiltered="False">
    <DataGridTemplateColumn.CellTemplate>
        <DataTemplate>
            <TextBlock x:Name="Collection" Text="{Binding Collection, Mode=OneWay}" MouseDown="DataGridTextColumn_MouseDown"></TextBlock>
        </DataTemplate>
    </DataGridTemplateColumn.CellTemplate>
</control:DataGridTemplateColumn>

The cause: FieldName and SortMemberPath are not set. Probably should have a default value set somewhere to prevent the app filter from crashing. Possibly get the type of the binding variable and auto set the fieldname, and pull the datacontext/source from the textblock or its parent and auto set the sort member path. <control:DataGridTemplateColumn Header=“MCN” MinWidth=“65” Width=“10*” MaxWidth=“150” IsColumnFiltered=“True” FieldName=“Collection” SortMemberPath=“Collection”>

Issue Analytics

  • State:closed
  • Created 8 months ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
macgilecommented, Feb 5, 2023

I tried to embed an “intellisense” notification to point out the required field but couldn’t find a way to make it work. It would have been more elegant.

1reaction
MrPlow254commented, Jan 10, 2023

File: FilterDataGrid.cs line 1229 is the issue. The popup is locked as open and never closes. This code change will allow for the filter to still work even though the fieldName is empty. if (string.IsNullOrEmpty(fieldName)) { popup.IsOpen= true; return; }

Read more comments on GitHub >

github_iconTop Results From Across the Web

How can I solve a toolbar bug with DataTemplates?
I tried the ItemTemplateSelector solution but it requires me to put the DataTemplate in the App.xaml resource, cause it doesn't have the ...
Read more >
[Bug] DataTemplate instances are initiated with width ...
So it seems that the data template instances are initiated before being 'added' to the collection view, as the converter will initially be ......
Read more >
UWP DataTemplate LoadContent has memory leak when ...
Describe the bug When calling DataTemplate.LoadContent , the memory will leak if the root element is not a framework control.
Read more >
Databinding bug when using ToolTipContentTemplate and ...
Hi! There is a strange behavior when using ToolTipContentTemplate and in The first time a tooltip is shown everything.
Read more >
MapView in ContentPresenter bug?
I was trying to display multiple viewmodels where the DataTemplate contains a MapView in an itemscontrol (TabControl), I discovered that the ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found