listcollectionview

Access objects dynamically set / created by Templates

可紊 提交于 2020-03-25 18:59:41
问题 I began a question here, but it doesn't seem to be concise enough. I have a DataGrid Bound to an object (Job): private String resultImagePath; // The Image to be shown in the DataGrid showing the status private String name; // The Job container's name private String jobDescription; // A Sub Task // AND the corresponding Public Properties implementing iPropertyChange public int Sequence; // For sorting purposses // The paths to the icons public String ErrorPath = "pack://application:,,,

Access objects dynamically set / created by Templates

假如想象 提交于 2020-03-25 18:59:06
问题 I began a question here, but it doesn't seem to be concise enough. I have a DataGrid Bound to an object (Job): private String resultImagePath; // The Image to be shown in the DataGrid showing the status private String name; // The Job container's name private String jobDescription; // A Sub Task // AND the corresponding Public Properties implementing iPropertyChange public int Sequence; // For sorting purposses // The paths to the icons public String ErrorPath = "pack://application:,,,

Access objects dynamically set / created by Templates

假如想象 提交于 2020-03-25 18:58:07
问题 I began a question here, but it doesn't seem to be concise enough. I have a DataGrid Bound to an object (Job): private String resultImagePath; // The Image to be shown in the DataGrid showing the status private String name; // The Job container's name private String jobDescription; // A Sub Task // AND the corresponding Public Properties implementing iPropertyChange public int Sequence; // For sorting purposses // The paths to the icons public String ErrorPath = "pack://application:,,,

WPF BindingListCollectionView to ListCollectionView for DataTable as ItemsSource

你离开我真会死。 提交于 2020-01-24 21:00:07
问题 I want to do custom sorting on a ListView which has a DataTable as ItemsSource: myListView.ItemsSource = (data as DataTable); And this are the first lines of my sorting function: DataView view = (myListView.ItemsSource as DataTable).DefaultView; ListCollectionView coll = (ListCollectionView)CollectionViewSource.GetDefaultView(view); The second line throws an execption like: Unable to cast "System.Windows.Data.BindingListCollectionView" to "System.Windows.Data.ListCollectionView" Has anyone a

SortDescriptionCollection is reset when using CustomSort

浪子不回头ぞ 提交于 2020-01-05 08:55:29
问题 This is my first time ever (literally) using C# and WPF. So I am hoping the issue I have is something basic and simple that I am just not aware of. Is there any way for my ListCollectionView to preserve its SortDescriptions after the CustomSort? Here is the original code that has the behaviour that I need: private void OnSorting(object sender, DataGridSortingEventArgs e) { e.Handled = true; DataGridColumn column = e.Column; var direction = (column.SortDirection != ListSortDirection.Ascending)

SortDescriptionCollection is reset when using CustomSort

不羁的心 提交于 2020-01-05 08:53:09
问题 This is my first time ever (literally) using C# and WPF. So I am hoping the issue I have is something basic and simple that I am just not aware of. Is there any way for my ListCollectionView to preserve its SortDescriptions after the CustomSort? Here is the original code that has the behaviour that I need: private void OnSorting(object sender, DataGridSortingEventArgs e) { e.Handled = true; DataGridColumn column = e.Column; var direction = (column.SortDirection != ListSortDirection.Ascending)

ListCollectionView moving to newly created record

社会主义新天地 提交于 2020-01-03 04:34:15
问题 When using a ListCollectionView, how do I move focus to the newly created record? My declarations are Public WithEvents Data As PersonList = PersonList.GetList() Private MyView As New ListCollectionView(Data) Private WithEvents _Person As Person The code I use to insert a person is _Person = New Person("AAAA", 100) Data.Insert(0, _Person) I've tried using MyView.MoveCurrentTo(Dunno what to put here) but nothing seems to work. If I was working with the underlying ObservableCollection then I

Dynamically set a property in an Item Template

百般思念 提交于 2019-12-13 05:35:15
问题 I set an image path of an Image in a StackPanel used in a GroupItem using the following resource (which as is works fine): <Style x:Key="GroupHeaderStyle" TargetType="{x:Type GroupItem}"> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type GroupItem}"> <Expander Name="expander" IsExpanded="True" > <Expander.Header> <StackPanel Orientation="Horizontal"> <Image Source="pack://application:,,,/Resources/History.ico" Margin="2,0" Width="18" Height="18" ></Image>

ComboBox's SelectedItem is unexpectedly set to null before actual value

孤街醉人 提交于 2019-12-10 19:22:57
问题 I have a ComboBox, whose ItemsSource is bound to a new (not default) ListCollectionView, which is linked to an ObservableCollection. The ComboBox SelectedItem property is bound to a public SelectedHat property. Step 1: Select the 2nd item in the ComboBox. SelectedHat is now the 2nd Hat in the list, as expected. Step 2: (Click the button to) Set the 2nd spot in the list to a new Hat. SelectedHat is first set to null, then set to the new Hat. Why is SelectedHat set to null before the new Hat? I

Does ListCollectionView leak memory?

北慕城南 提交于 2019-12-10 01:47:40
问题 I've been investigating how to avoid memory leaks caused by strong references to the INotifyCollectionChanged event from a view model. I was playing around with using a ListCollectionView to see if that would deal with it for me. I think that the following is leaking memory, am I doing something wrong? var stuff = new ObservableCollection<string>(); while (true) { var result = new ListCollectionView(stuff); // Just to keep make sure that the memory I'm seeing // isn't waiting to be GC'd GC