WPF - Maintain Group Style in ListView -
I have found a simple list view that draws data from an Observe Collection, and I have a collection of ViewSource in a group property description set I'm using my rows to group I have used the following style to use an extension for each group:
style target type = "{x: type Group entity} "x: key =" listViewGroupStyle "& gt; & Lt; Setter property = "margin" value = "0 0 5 5" /> & Lt; Setter Estates = "Template" & gt; & Lt; Setter.Value & gt; & Lt; ControlTemplate TargetType = "{x: Type GroupItem}" & gt; & Lt; Expander IsExpanded = "False" BorderBrush = "{Compulsive name, converter = {static resource status player converter}}" bordertextness = "2" margin = "1" & gt; & Lt; Expander.Header & gt; & Lt; Border bordercutness = "3" borderbrush = "{binding name, converter = {static resource status background converter}}" cornerreadia = "6" & gt; & Lt; DockPanel TextBlock.FontWeight = "Bold" TextBlock.Foreground = "{binding name, converter = {StaticResource statusForegroundConverter}}" & gt; & Lt; TextBlock Text = "{binding name, converter = {static processing data string converters}}" margin = "5 2 2 2" /> & Lt; Text block text = "-" margin = "2" /> & Lt; TextBlock Text = "{Binding Path = ItemCount}" margin = "0 2 5 2" /> & Lt; / DockPanel & gt; & Lt; / Border & gt; & Lt; /Expander.Header> & Lt; Expander.Content & gt; & Lt; Item receptor / & gt; & Lt; /Expander.Content> & Lt; / Expander & gt; & Lt; / ControlTemplate & gt; & Lt; /Setter.Value> & Lt; / Setter & gt; & Lt; / Style & gt;
I have a problem in order that my collection is updated frequently and all the time it happens that all the groups will collapse or not, whether I was open or not.
Is there a way to retain the listing view after re-appointing my collection?
I have found a solution, in which most of the details are given here:
The main point is that when the item source is recruited again, it invalidates the respective control, due to which it is again, however, as I am using an overview compilation Was to submit your new data to the temporary list and add or remove objects from the original list:
ObservableC Ollection & lt; Xxx & gt; TempBuilds = new reviewable collection & lt; Xxx & gt; (); IEnumerable & LT; Xxx & gt; AddRange = tempBuilds.Except (_filteredBuilds); IEnumerable & LT; Xxx & gt; RemoveRange = _filteredBuilds.Except (tempBuilds); AddRange.ToList (). ForEach (bm = & gt; _filteredBuilds.Add (bm)); Deleted Range. List for () Ex (for BM => _philildbed. Remove (BM));
Comments
Post a Comment