Reputation: 93
I implemented a list view with drag and drop functionality on first drag and drop contents in ListViewItem are missing or hiding and after second drag and drop the same item comes into existence, can some one explain me this behavior? and how to solve this issue?
Upvotes: 0
Views: 56
Reputation: 8666
The behavior is related to the binding. You are binding a RelativePanel
control to the ContentControl
of the DataTemplate
. That's not a good design which will affect the re-render of the item.
Our suggestion is that please make sure the model is just about data and put all the controls into the DataTemplate
.
For example the DataTemplate:
<DataTemplate x:Key="dataTemplate" x:DataType="local:Entity">
<ContentControl >
<RelativePanel >
<TextBlock Text="{Binding Id}"/>
</RelativePanel>
</ContentControl>
</DataTemplate>
Entity Class:
public class Entity
{
public string Id { get; set; }
public Entity(string name1)
{
Id = name1;
}
}
If you want to have different DataTemplate
based the specific data, just use the DataTemplateSelector-Data template selection: Styling items based on their properties.
Upvotes: 1