Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6771949
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T15:29:32+00:00 2026-05-26T15:29:32+00:00

I have separate library (Controls.DLL) with my custom Controls. I have another library (Model.dll)

  • 0

I have separate library (Controls.DLL) with my custom Controls.
I have another library (Model.dll) with my data access code.

Some controls do need access to data. I’d like to keep those libraries loosely coupled. Basically, I’d like to acces data without referencing Model.dll

What is the proper way to do it? Naturally, I think Binding is a way to go. But it’s not just binding to data, I also need to execute actions against my model (retreive data, paging, filtering). And I need to study metadata that my model contains.

For example, I have Customer class with properties like “FirstName”, “LastName”, etc. But I want those to be displayed inside my control with captions like “First Name”, “Last Name”. This is primitive example but it kind of shows my point.

My other idea was to have “providers” on data side that would spit out XML and on control side I will parse this XML. But how do I go about methods?

Another idea is to go with reflection. This way I would just pass object to Control. But I’m not as good with reflection and not sure if I can achieve things like: getting properties/attributes. Getting and executing methods? This sounds like a perfect thing to code with Interfaces but Interface need to live somewhere and therefore something have to reference something.

So, what is the best way to code loosely like this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T15:29:33+00:00Added an answer on May 26, 2026 at 3:29 pm

    Check out the MVVM pattern (Model-View-ViewModel).

    Basically, a ViewModel wraps a Model, and exposes data access and data manipulation commands to the user interface (the View) via property bindings.

    You’ll find heaps of documentation, tutorials etc. by searching for MVVM. Or check out this StackOverflow answer to get you started.

    Update:

    MVVM allows you to separate custom controls and data. It sounds like you want to dynamically generate interface components based upon data in your model. You can do this in MVVM (it’s not the only way, of course). The view model can dynamically generate collections based upon the model. The view model can include methods for converting raw data to display data. This means neither your model or controls (view) need to know how to
    do this.

    Depending on the nature of your data, you may choose to have `generic’ view models reflect over property names to procedurally generate display names (as in your primitive example), or you may choose to write specific view models for specific data in your model. That will depend upon the nature of your data. Either way, your custom controls (in the view) remain decoupled from the model.

    Update 2:

    Your view models do not need to live in the same assembly as the view (controls). You can even put them in a third assembly (as described here). Of course that encourages you to follow MVVM more strictly and make sure you have no dependencies from ViewModel to View, but that’s a good thing. There are a few more hints on the issues related to hooking up views to view models you may encounter here.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In my ASP.NET application I have separate projects for the Data, Business and UI
I have a table of data which has posts, then I have a separate
Hi all fellow programmer I'd like to have a separate js file for each
I have a silverlight class library (not a top-level application) with several user controls
I need to put different information in separate lines, I have a working Javascript
We have Tabs-Menu controls which rely on jQuery library and the dev-manager insist that
I would like to make a library of some of my commonly used WPF
I'm trying to abstract out all database code into a separate library and then
I need to separate ViewModels in my MVC project from my business models (Data
In my WPF project i keep a user control in a separate library project.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.