observablecollection

ObservableCollection<T> in Winforms and possible alternatives

社会主义新天地 提交于 2019-12-29 07:16:52
问题 Winforms .net 3.5 app. In my app I have a generic class that looks like so: public class FilterItem { public FilterItem() { } public string FilterProperty { get; set; } public bool FilterPropertyChecked { get; set; } public ComparitiveOperator FilterOperator { get; set; } public string FilterValue { get; set; } } and I use it in all of my dialog boxes when I want to implement some sort of filter functionality. So I call the dialog form with a pre-poulated List<FilterItem> passed in the

how to sort ObservableCollection

半城伤御伤魂 提交于 2019-12-28 10:06:25
问题 I have a an ObservableCollection and a WPF UserControl is Databound to it. The Control is a graph that shows a vertical bar for each item of type BarData in the ObservableCollection. ObservableCollection<BarData> class BarData { public DateTime StartDate {get; set;} public double MoneySpent {get; set;} public double TotalMoneySpentTillThisBar {get; set;} } Now I want to sort out the ObservableCollection based on StartDate so that the BarData's will be in increasing order of StartDate in the

WPF Multiple CollectionView with different filters on same collection

夙愿已清 提交于 2019-12-28 08:08:11
问题 I'm using a an ObservableCollection with two ICollectionView for different filters. One is for filtering messages by some type, and one is for counting checked messages. As you can see message filter and message count works OK, but when I'm un-checking the message disappear from the list ( the count is still working ). BTW sorry for the long post, I wanted to include all relevant stuff. The XAML Code: <!-- Messages List --> <DockPanel Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="3" Height=

Filtering an ObservableCollection?

徘徊边缘 提交于 2019-12-28 06:01:28
问题 When I bind a ListBox directly to an ObservableCollection I get the real-time updates displayed in my ListBox, but as soon as I add other LINQ methods in the mix my ListBox is no longer notified of any changes to the ObservableCollection. Here, let me illustrate with an example; public partial class MainPage : PhoneApplicationPage { ObservableCollection<String> Words = new ObservableCollection<string>(); public MainPage() { InitializeComponent(); listBox1.ItemsSource = Words; } private void

Filtering an ObservableCollection?

南楼画角 提交于 2019-12-28 06:01:09
问题 When I bind a ListBox directly to an ObservableCollection I get the real-time updates displayed in my ListBox, but as soon as I add other LINQ methods in the mix my ListBox is no longer notified of any changes to the ObservableCollection. Here, let me illustrate with an example; public partial class MainPage : PhoneApplicationPage { ObservableCollection<String> Words = new ObservableCollection<string>(); public MainPage() { InitializeComponent(); listBox1.ItemsSource = Words; } private void

Why do I get this NullReferenceException sometimes?

删除回忆录丶 提交于 2019-12-25 17:16:08
问题 Here's piece of code where It throws the exception sometimes: Pendings = ClientCode.PendingOrders.Select(x => new DisplayPending() { ItemCode = ClientCode.Items.First(y => y.Id == x.ItemCode).Id, ItemName = ClientCode.Items.First(y => y.Id == x.ItemCode).Name, OrderNo = x.BuyOrderNo == 0 ? x.SellOrderNo : x.BuyOrderNo, OrderType = x.OrderType == OrderType.Buy ? "Buy" : "Sell", PartyCode = x.PartyCode, Price = x.Price, Quantity = x.Quantity }); and here's the message: System

How to obtain row index and assign it to observable collection property of datagrid

天涯浪子 提交于 2019-12-25 16:42:22
问题 Basically, I have a DataGrid inside a DataGrid: <DataGrid ScrollViewer.CanContentScroll="True" ScrollViewer.HorizontalScrollBarVisibility="Auto" AutomationProperties.AutomationId="sCGridSelectedBasketItems" HeadersVisibility="Row" Height="{Binding ElementName=itemsgrid,Path=ActualHeight}" Grid.Row="1" RowDetailsVisibilityMode="Visible" CanUserAddRows="false" VerticalAlignment="Top" AutoGenerateColumns="False" SelectedItem="{Binding SelectedBasketItem}" ItemsSource="{Binding

ObservableCollection inside ObservableCollection doen't fire Collection changed event

左心房为你撑大大i 提交于 2019-12-25 08:13:22
问题 For the last three days I've been facing a quite a composite problem. I am trying to make an order taking app, to do this I wanted to have an ObservableCollection containing MainCategory items. Now the MainCategory items contained a CategoryName and another ObservableCollection of dishes. The dishes have those props: name, price and quantity. I did all this and the bindings and everything works perfectly. The problem is at the bottom of the page (outside the ListView which is nested inside a

WPF: refreshing value of a computed field in an item of an ObservableCollection

佐手、 提交于 2019-12-25 06:47:29
问题 I have an issue with my WPF ObservableCollection. I have an ObservableCollection (_additionalCosts) bound to a ListView which includes one readonly computed field based on the value of other properties in the item and, crucially, the value of another dropdown. When I change the selected item of the dropdown I would like the computed field to refresh, which it is not doing at the moment. My view class looks like this: [Serializable] public class BookingView : ViewBase { private

WPF ListView databinding to ObservableCollection

柔情痞子 提交于 2019-12-25 04:47:15
问题 In WPF app I have a ListView : <ListView Height="100" Width="434" x:Name="lvItems" ItemsSource="{Binding ElementName=MainWindow, Path=ShowQuCollection}" > <ListView.View> <GridView> <GridViewColumn Header="Date" Width="100" DisplayMemberBinding="{Binding Date}"/> <GridViewColumn Header="Time" Width="100" DisplayMemberBinding="{Binding Time}"/> <GridViewColumn Header="Description" Width="200" DisplayMemberBinding="{Binding Description}"/> </GridView> </ListView.View> which is connected with