datacontext Questions

3

Solved

IN an MVVM pattern is it acceptable or even possible to access ViewModel properties in the views code behind? I have an observable collection which is populated in the ViewModel. I need to use it ...
Jarietta asked 6/12, 2012 at 21:48

21

Solved

I have ConsoleApplication on .NET Core and also I added my DbContext to dependencies, but howewer I have an error: Unable to create an object of type 'MyContext'. For the different patterns suppor...
Breannebrear asked 1/9, 2019 at 11:9

7

Solved

I am integrating SqlCacheDependency to use in my LinqToSQL datacontext. I am using an extension class for Linq querys found here - http://code.msdn.microsoft.com/linqtosqlcache I have wired up th...
Conias asked 3/5, 2010 at 15:2

8

Solved

I need to expose an Entity Framework Data Context to 3rd party plugins. The purpose is to allow these plugins to fetch data only and not to let them issue inserts, updates or deletes or any other d...

7

Solved

I have an object in my view model that has a bunch of properties, some of them will occasionally be null. I don't want to just show some controls if these particular controls are null. How would I ...
Desalvo asked 16/3, 2011 at 10:16

4

Solved

I am learning Entity Framework. I created a demo app using Entity framework code first approach (without specifying any connection string). static void Main(string[] args) { CreateBlog(); } p...
Tetryl asked 16/1, 2015 at 11:34

4

Solved

Here's the issue: I have 2 data contexts that I would like to do a join on. Now I know that LINQ doesn't allow joins from one context to another, and I know that 2 possible solutions would be to e...
Throw asked 22/5, 2009 at 15:6

6

Solved

I'm creating a UserControl I want to use something like this: <controls:ColorWithText Color="Red" Text="Red color" /> So far, I've implemented similar controls like this: <UserControl ...
Involution asked 22/2, 2011 at 11:16

3

Solved

I Have window that have DataContext that is bind to ViewModel object (VM1 for the example). VM1 have a lot of properties and one of them is a string that called "MyTitle". I have a DataGridTextCol...
Asymptotic asked 6/6, 2013 at 15:3

5

I need to access the container's DataContext from a UserControl (a grid containing textboxes and a listbox: I need to insert items in this list box) that I created in WPF: which is the best way to ...
Orangery asked 4/7, 2011 at 19:0

6

I am often comparing data in tables in different databases. These databases do not have the same schema. In TSQL, I can reference them with the DB>user>table structure (DB1.dbo.Stores, DB2.db...
Powerless asked 29/9, 2009 at 22:47

3

The reason React has contexts is to allow for multiple sibling components to share a piece of state-data. It is the go-to method for allowing two unrelated components to read/write in shared variab...
Hardihood asked 23/11, 2019 at 21:27

4

<Canvas.DataContext> <ViewModels:VMSomeControl Model="{Binding RelativeSource={RelativeSource TemplatedParent}}" /> </Canvas.DataContext> <!-- DataContext is not...
Overweary asked 7/6, 2010 at 14:39

4

Solved

I am having some trouble figuring out how to set the correct DataContext on a ContextMenu. I have a collection of view models who are the source of an ItemsControl. Each view model has a collecti...
Mazur asked 22/2, 2013 at 21:30

3

Solved

I just started learning MVVM and here is what seems to be basic question but I spent whole day trying to figure it out. I have a solution that contains 3 projects one for Model, one for ViewModel ...
Linkboy asked 26/4, 2017 at 18:9

2

Solved

An easy one ;-) I declared: xmlns:om="clr-namespace:System.Collections.ObjectModel;assembly=System" I try to set a generic as the DataType: <DataGrid d:DataContext="{ d:DesignInst...
Squeamish asked 27/7, 2010 at 0:25

4

Solved

I want to reuse my UserControls in other UserControls like page or window as DataTemplates, in this example inside a ListBox. Everything is MVVM. I've a UserControl called "CardControl" to display...
Tailstock asked 12/9, 2011 at 14:12

2

I have the following MainWindow that lays out a left side navigation panel and a right side display area (both of these are UserControls). Can someone explain how to assign the DataContext of the...
Malaspina asked 2/1, 2013 at 5:27

2

We have an application using SDK provided by our provider to integrate easily with them. This SDK connects to AMQP endpoint and simply distributes, caches and transforms messages to our consumers. ...
Lathrope asked 23/12, 2019 at 11:2

3

I want to declare a DataContext through a static resource in XAML as a binding for the Customers in the Northwind database. I can do this easily in code (C#) but want to learn how to do in XAML. I ...
Decentralization asked 16/8, 2010 at 19:25

10

Solved

This sounds like it should be simple. I have a Page declared in XAML in the normal way (i.e. with "Add new item...") and it has a custom property. I'd like to set that property in the XAM...
Oliphant asked 7/9, 2010 at 10:27

4

Solved

I have a DataContext (Linq to Sql) with over 100 tables, is it possible to get a list of all those tables and lets say print them to the console? This might be a silly question. Thanks.
Rebirth asked 9/4, 2009 at 22:55

3

Solved

I've a static class which reads information from the application assembly. I've declared it static since the class needs no instance declaration and will only ever be read directly from, applicati...
Semitropical asked 10/1, 2015 at 19:47

2

I have a binding to a parent-element. How can I provide the data type for the DataContext in the binding, so intellisense can resolve the bound Properties? The binding works fine at runtime. So, ...
Carlicarlick asked 5/7, 2016 at 11:38

2

Solved

Following up on this question/answer How to make Entity Framework Data Context Readonly The solution is to make your DbContext collections of the type DbQuery, but that is a rather specialized typ...
Viola asked 23/12, 2014 at 16:37

© 2022 - 2024 — McMap. All rights reserved.