Could not find an implementation of the query pattern

Is the tblPersoon implementing IEnumerable<T>? You may need to do it using: var query = (from p in tblPersoon.Cast<Person>() select p).Single(); This kind of error (Could not find an implementation of the query pattern) usually occurs when: You are missing LINQ namespace usage (using System.Linq) Type you are querying does not implement IEnumerable<T> Edit: Apart … Read more

This type of CollectionView does not support changes to its SourceCollection from a thread different from the Dispatcher thread [duplicate]

Since your ObservableCollection is created on UI thread, you can only modify it from UI thread and not from other threads. This is termed as thread affinity. If you ever need to update objects created on UI thread from different thread, simply put the delegate on UI Dispatcher and that will do work for you … Read more

How do I space out the child elements of a StackPanel?

Use Margin or Padding, applied to the scope within the container: <StackPanel> <StackPanel.Resources> <Style TargetType=”{x:Type TextBox}”> <Setter Property=”Margin” Value=”0,10,0,0″/> </Style> </StackPanel.Resources> <TextBox Text=”Apple”/> <TextBox Text=”Banana”/> <TextBox Text=”Cherry”/> </StackPanel> EDIT: In case you would want to re-use the margin between two containers, you can convert the margin value to a resource in an outer scope, f.e. … Read more

How to automatically select all text on focus in WPF TextBox?

We have it so the first click selects all, and another click goes to cursor (our application is designed for use on tablets with pens). You might find it useful. public class ClickSelectTextBox : TextBox { public ClickSelectTextBox() { AddHandler(PreviewMouseLeftButtonDownEvent, new MouseButtonEventHandler(SelectivelyIgnoreMouseButton), true); AddHandler(GotKeyboardFocusEvent, new RoutedEventHandler(SelectAllText), true); AddHandler(MouseDoubleClickEvent, new RoutedEventHandler(SelectAllText), true); } private static void … Read more

Difference between SelectedItem, SelectedValue and SelectedValuePath

Their names can be a bit confusing :). Here’s a summary: The SelectedItem property returns the entire object that your list is bound to. So say you’ve bound a list to a collection of Category objects (with each Category object having Name and ID properties). eg. ObservableCollection<Category>. The SelectedItem property will return you the currently … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)