observablecollection

WPF TreeView bound to ObservableCollection not updating root nodes

梦想与她 提交于 2020-01-21 01:47:05
问题 Sorry - my question is almost identical to this one but since it didn't receive a viable answer, I am hoping that someone else has some fresh ideas. I have a WPF TreeView that is bound to a hierarchy of a single type: public class Entity { public string Title { get; set; } public ObservableCollection<Entity> Children { get; set; } } The Entity class implements INotifyPropertyChanged, but I have omitted this code for clarity. The TreeView is bound to an ObservableCollection<Entity> and each

Why NOT BindingList in WPF

拈花ヽ惹草 提交于 2020-01-20 02:40:05
问题 I have asked this question on MSDN forums as well ... http://social.msdn.microsoft.com/Forums/en/wpf/thread/4493988a-9bd8-48fe-aff0-348502136a80 I need to know that why Microsoft suggests that BindingList is not properly supported in WPF... What is it that doesnt work with BindingList in WPF? I find it pretty useful as it is. So far I personally have not found BindingList any slower or a having more load on memory. Plus WPF ItemsControls , ItemsTemplates , Styles , Hierarchies work great with

MVVM ObservableCollection Bind TwoWay

巧了我就是萌 提交于 2020-01-17 08:37:10
问题 I have been working with MVVM and wondering how to make use of ObservableCollection to bind to an ItemsSource in TwoWay? For example, I have an Custom Drawing UserControl called SmartDraw, in which the ItemsSource refers to the list of Custom Graphics and it is bound to an ObservableCollection Graphics in the View Model. If I add a CustomGraphic in the view model, the ItemsSource in the SmartDraw will know that there is an addition of CustomGraphic and then do some other function calls. It is

Databinding ObservableCollection<T> to Datagrid not working

强颜欢笑 提交于 2020-01-16 02:54:16
问题 Update Now I think I have narrowed the problem. I created single class public class OptionStrike { public OptionStrike(double p1, double p2, int p3) { // TODO: Complete member initialization P_OI = p1; StrikePrice = p2; P_Volume = p3; } public OptionStrike() { // TODO: Complete member initialization } public double P_OI { get; set; } public double P_Volume { get; set; } public double StrikePrice { get; set; } } Now, if i load the values to this OptionStrike as private void Test(object obj) {

ObservableCollection wrapper to cast to a base type

僤鯓⒐⒋嵵緔 提交于 2020-01-15 10:36:07
问题 I have a class called Client , which is a subclass of Configurable . I have an ObservableCollection<Client> which I need to view as an ObservableCollection<Configurable> . This will allow me to databind to the list from some general layout generation code. It must also allow me to clear the list, and to add items to the list. Of course, when adding items to the list it must do a runtime type check to verify the general item ( Configurable ) being added is of the appropriate type ( Client ). I

WPF DataGridRow.IsNewItem Remained True even after DataGridRow.Item its NOT CollectionView.NewItemPlaceholder

不打扰是莪最后的温柔 提交于 2020-01-15 05:32:10
问题 After tracking the DataGridRow.Item and DataGridRow.IsNewItem properties, I discover that: each added item (to DataGrid when Source is ObservableCollection<MyClass> ), IsNewItem Always positive, Although Item Although he is not a NewItemPlaceholder . Afterwards I looked at MSDN and saw that it was indeed affected by two factors: Gets or sets a value that indicates whether the DataGridRow is a placeholder for a new item or for an item that has not been committed . How do I committ added item?

Updating one element of a bound Observable collection

柔情痞子 提交于 2020-01-14 14:12:09
问题 I have an observable collection with a custom class called songInfo inside. It is bound to a ListView . Here is the code for the binding: C# : var songData = new ObservableCollection<songInfo>(); public ObservableCollection<songInfo> _songData { get { return songData; } } public class songInfo { public string Title { get; set; } public string Artist { get; set; } public string Album { get; set; } public string Location { get; set; } public string Ext { get; set; } public bool isSongPlaying {

Updating one element of a bound Observable collection

大兔子大兔子 提交于 2020-01-14 14:11:55
问题 I have an observable collection with a custom class called songInfo inside. It is bound to a ListView . Here is the code for the binding: C# : var songData = new ObservableCollection<songInfo>(); public ObservableCollection<songInfo> _songData { get { return songData; } } public class songInfo { public string Title { get; set; } public string Artist { get; set; } public string Album { get; set; } public string Location { get; set; } public string Ext { get; set; } public bool isSongPlaying {

Getting a WPF Listview to display ObservableCollection<T> using databinding

爱⌒轻易说出口 提交于 2020-01-14 08:21:26
问题 I have a observable collection of type Project, that I want to be displayed in a ListView but nothing is added to my ListView which I really dont understand My MainWindow.xaml <ListView Name="ListViewProjects" Grid.Column="0" Grid.RowSpan="3" SelectionChanged="ListViewProjectsSelectionChanged" ItemsSource="{Binding}" IsSynchronizedWithCurrentItem="True" MinWidth="100"> <ListView.ItemTemplate> <DataTemplate> <WrapPanel> <TextBlock Text="{Binding Path=ProjectID}"/> <TextBlock Text="{Binding

Getting a WPF Listview to display ObservableCollection<T> using databinding

懵懂的女人 提交于 2020-01-14 08:20:13
问题 I have a observable collection of type Project, that I want to be displayed in a ListView but nothing is added to my ListView which I really dont understand My MainWindow.xaml <ListView Name="ListViewProjects" Grid.Column="0" Grid.RowSpan="3" SelectionChanged="ListViewProjectsSelectionChanged" ItemsSource="{Binding}" IsSynchronizedWithCurrentItem="True" MinWidth="100"> <ListView.ItemTemplate> <DataTemplate> <WrapPanel> <TextBlock Text="{Binding Path=ProjectID}"/> <TextBlock Text="{Binding