Top "Datacontext" questions

A DataContext is used in WPF, Silverlight and various other .NET technologies.

Setting DataContext within UserControl is affecting bindings in parent

I have a basic UserControl that sets its DataContext to itself for ease of binding: <UserControl x:Class="MyControlLib.…

wpf xaml data-binding user-controls datacontext
UWP Databinding: How to set button command to parent DataContext inside DataTemplate

Short explanation of need: I need to fire the command of a button inside a DataTemplate, using a method from …

c# xaml data-binding uwp datacontext
LINQ To SQL exception with Attach(): Cannot add an entity with a key that is already in use

Consider this typical disconnected scenario: load a Customer object from SQL Server using LINQ To SQL user edits the entity, …

c# linq-to-sql concurrency datacontext
using IValueConverter with current DataContext in two-way binding

I'm having issues with a converter i'm using to convert between a string and our timeformat. The converter itself works …

wpf data-binding datacontext converter ivalueconverter
Bind to parent DataContext within DataTemplate

I'm trying to bind MenuItem's Command to command contained in UserControl.DataContext. I've found couple of similar question, but solution …

.net wpf data-binding datacontext
LINQ to SQL multiple DataContext-s

I'm trying to figure the best strategy about how to organize DataContexts. The typical DB we work has between 50 and 100 …

sql linq linq-to-sql datacontext
How do I set WPF xaml form's Design DataContext to class that uses generic type parameters

Originally my .xaml form used the following line to set the Designer's DataContext where the view model was a non-generic …

wpf xaml datacontext
WPF Show data from multiple DataContexts in ToolTip of ItemsControl

I am trying to display a tooltip for an item generated by an ItemsControl that needs to pull data from …

wpf data-binding tooltip datacontext itemscontrol
What does LINQ-to-SQL Table<T>.Attach do?

What exactly does the LINQ-to-SQL method Table<T>.Attach() and Table<T>.AttachAll() and what is …

c# linq linq-to-sql datacontext
How do I correctly manage the disposing of a DataContext?

I have a web service that is quite heavy on database access. It works fine in test, but as soon …

c# linq-to-sql datacontext dispose idisposable