Questions tagged [datacontext]

A DataContext is used in WPF, Silverlight and various other .NET technologies. When used with WPF or Silverlight, a DataContext is an object holding the data that the form (or page in case of Silverlight) uses as a display source for its UI elements.

A DataContext is used in WPF, Silverlight and various other .NET technologies. When used with WPF or Silverlight, a DataContext is an object holding the data that the form (or page in case of Silverlight) uses as a display source for its UI elements. The DataContext in this case is the default object to bind against for any bindings that you have specified for other properties on the UI elements.

Ref: FrameworkElement.DataContext

1485 questions
-1
votes
1 answer

WPF Setting DataContext

I am trying to learn WPF and binding but don't seem to be able to understand what is going on. I have copied a code sample using a combobox and have been trying modifying it to see what happens. The problems appears to be with setting the…
-1
votes
3 answers

Insert NVARCHAR string using LINQ to SQL

Here is the problem. I have a table in a SQL Server database CREATE TABLE Users ( [userID] INT PRIMARY KEY IDENTITY, [userName] NVARCHAR(255) NOT NULL, [userEmail] VARCHAR(127) NOT NULL, …
Dmytro Bogatov
  • 776
  • 1
  • 10
  • 23
-1
votes
1 answer

Linq to SQL Bombing Out on DataContext

For some reason my code just decided to stop working after doing a build and not sure what the issue is. public class clsSaveError { public clsSendEmail.clsSendEmail SendEmail = new clsSendEmail.clsSendEmail(); public clsSettings.clsSEttings…
-1
votes
1 answer

Can I specify a set of base parameters for a Linq-to-sql DataContext?

I have a LINQ-to-SQL DataContext that represents a parent-child relationship of Products to Prices. I'm iterating through a list of products and retrieving the prices for each one. The problem is that the tables behind both the Products and Prices…
cori
  • 8,666
  • 7
  • 45
  • 81
-1
votes
1 answer

Introduction to DataContext and DataSet

Can anyone help me understand DataContext and DataSet ? I am leaning Entity Framework and I need to clear this concepts in my mind properly. I tried to read in the book, read some articles but all the language there was so complex, can anyone…
-1
votes
1 answer

How to implement MVVM with a static class

I have a class written in this way public class AudioPlayer : INotifyPropertyChanged { public event PropertyChangedEventHandler PropertyChanged; // This method is called by the Set accessor of each property. // The CallerMemberName…
user1649247
  • 47
  • 2
  • 7
-2
votes
1 answer

how to connect to multiple ftp sites based on the ftphost name using one talend job

I am trying to connect to multiple ftp sites ,the thing is only the ftp host name (ip address) varies between different ftp sites and the username,password,port ,directory are all the same where i would to download and read /retrieve the latest…
Tommy
  • 55
  • 1
  • 6
-2
votes
1 answer

WPF DataContext. Taking from another class

having general DataContext taken from class SearchByID there's a need to take a separate DataContext from another class, say, testClass. XAML example:
-2
votes
1 answer

WPF Closing a Window from the a UserControl MVVM

I currently have a problem with my Binding because upon pressing a Button, it should close a certain Window but it doesn't. This is a more detailed description of the situation: In my Application, I have the following button: Upon pressing it, a…
Randy Quackers
  • 665
  • 1
  • 7
  • 16
-2
votes
2 answers

How to handle DataContext that binds to Generic ViewModel, and access the Generic ViewModel in CodeBehind properly in MVVM?

I have a generic ViewModel: ViewModel public class GenericViewModel { public IList SomeList {get; set;} } I have to bind the MainWindow's DataContext to this GenericViewModel. However, I do not know how I should put the thing for…
Tom Fong
  • 125
  • 8
-2
votes
1 answer

WPF MVVM navigation conflicting each other

In my project, I have a class MainViewModel where I have DataContext property and I load MENU in MainWindow from Database using DataContext. In MainWindow, I have a ContentControl to load UserControl. When I click MENU ITEMS, it should calls a…
logcat
  • 485
  • 12
  • 22
-3
votes
1 answer

C# - WPF - Binding Issue - Unable to bind C# properties in XAML

I'm just getting started with WPF in C#, currently using Visual Studio 2019, WPF application in .NET Framework 4.7.2. I've been struggling with data binding for a few days now, going through numerous tutorials and websites, trying to figure out what…
NateLFO
  • 9
  • 2
-3
votes
1 answer

WPF View not binding unless I switch view before

I'm trying to dev a WPF app which displays 3 views that we can switch using a side menu. The first View displays articles. I've tried this view in another project on its own and it works just fine. My issue: The problem is that when I use it in my…
-3
votes
1 answer

How to mock datacontext (LINQToSQL) which is part of another assembly?

I am using LinqToSQL in my project.As pert of my unit testing, I am trying to mock datacontext which is part of another assembly which is referenced in the ASP.NET WEB API project. Based on the following…
-6
votes
1 answer

What is the use of WPF Toolkits?

I recently started working for a small software company and we are developing a small app with WPF, 6 to 10 screens (views?) probably. The first thing I noticed is that no toolkits are being used. I have little experience with WPF, mainly dealing…
1 2 3
98
99