Thursday, 15 September 2011

wpf listview gridview swaping item template -


I have a list view that is displaying data using gridview. This list is displaying general data of grid views. Too many data displayed in rows and columns However, I have no data to display in columns on some lines. I would like to swap the item template for that line and would like to display another template for the entire row, which will display something like "blank line" or "blank line" for the text and the entire row is the style of different cells Do not Show

I'm trying to use this post :.

Then I have a custom view for the list view. In fact, I've given the sub-class to the Gridview class and on the prepared method method override, I can choose a new template that I want to display for a particular line or default template. However, when I try to choose a new template, gridview will never render it for that line if I use the default template it will still render it. I think the layout for any gridview is interfering with the setting of the template for that line which I want to swap. Is it possible or will I have to create a custom view that mimics the gridview and does not subdivide the gridwish class? Any suggestions or anybody have the experience of this type of scenario, do I want to keep the columns without much work?

You can use DataTriggers, use code like this (some items do not have value of 0 or 0 Depending on, switching templates depending on):

  & gt; DataTemplate x: key = "MyItemTemplate" & gt; & Lt; StackPanel & gt; & Lt; StackPanel name = "normal stackpanel" & gt; & Lt ;! - Template for normal line - & gt; & Lt; / StackPanel & gt; & Lt; StackPanel name = "blank phase port" visibility = "brief" & gt; & Lt ;! - Template for empty line - & gt; & Lt; / StackPanel & gt; & Lt; / StackPanel & gt; & Lt; DataTemplate.Triggers & gt; & Lt; Datatrigger binding = "{some binding object properties}" value = "0" & ​​gt; & Lt; Setter TargetName = "General StackPainel" property = "visibility" value = "abbreviated" /> & Lt; Setter TargetName = "blank stack panel" property = "visibility" value = "visible" /> & Lt; / DataTrigger & gt; & Lt; /DataTemplate.Triggers> & Lt; / DataTemplate & gt;  

Hope it helps.


No comments:

Post a Comment