Quantcast
Channel: Windows Presentation Foundation (WPF) forum
Viewing all articles
Browse latest Browse all 18858

Search by DatePicker.value to display item from database in my listview

$
0
0

I would like to match datepicker value to match the date field in my database which is (cbModification) to display items by the date choosed. my problem is that my listview didn't display any item. here is my Xaml code:

<DatePicker x:Name="DatePicker" HorizontalAlignment="Left" Margin="363,12,0,0" VerticalAlignment="Top" Width="164" SelectedDate="{x:Static sys:DateTime.Now}" FirstDayOfWeek="Monday" Text="4/27/2016"><DatePicker.Resources><Style TargetType="{x:Type DatePickerTextBox}"><Setter Property="Control.Template"><Setter.Value><ControlTemplate><TextBox x:Name="PART_TextBox"
                                Text="{Binding Path=SelectedDate, RelativeSource={RelativeSource AncestorType={x:Type DatePicker}}, StringFormat={}{0:yyy-MM-dd}}" /></ControlTemplate></Setter.Value></Setter></Style></DatePicker.Resources></DatePicker>

and my c# code if someone could help :

TOPSAGEEntities db = new TOPSAGEEntities();

        var query = from fournisseur in db.F_COMPTET
                    join email in db.F_ECHEANCES on fournisseur.CT_Intitule equals email.ECH_Intitule
                    where email.cbModification.ToString().Contains(DatePicker.Text)
                    select new { fournisseur = email.ECH_Intitule, email = fournisseur.CT_EMail, date = email.cbModification};

        listView.DataContext = query.ToList().Distinct();



Viewing all articles
Browse latest Browse all 18858

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>