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

  • Home
  • SEARCH
  • 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 7248549
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T22:09:11+00:00 2026-05-28T22:09:11+00:00

I have an Entity result of List<string> GetTagsData that I need to somehow bind

  • 0

I have an Entity result of List<string> GetTagsData that I need to somehow bind with checkboxes in an ObservableCollection and then to a DataGrid. These checkbox bindings correspond to a dynamic comma delimited string that is a subset of that entity result GetTagsData except it’s in a comma delimited string. The user then can uncheck or check each item in the DataGrid and then we call an event handler to basically regenerate the comma delimited string. My question is this, Is there a better way of architecting this solution? I see this as potential problematic to maintain in the future. the only thing that I can’t change is the comma delimited string coming in and out. and I have to build it in silverlight. Thanks ahead!

Comma Delimited String

'Chicago','New York','Boston','Los Angeles'

Entity Result for List<string> GetTagsData

GetTagsData = SecurityDomainContext.Current.vwBusinessUnits.Select(d => d.Market).Distinct().ToList();

ObservableCollection Class

    public class TagsCollection : ViewModelBase 
{
    private string _tag;   
    private bool _isSelected; 
    public string Tag
    {
        get
        { return _tag; }
        set 
        { _tag = value; }
    }

    public bool IsSelected
    {
        get 
        { return _isSelected; }
        set 
        { _isSelected = value; }
    }  

Now in my ViewModel I am able to iterate the Entity results into the Collection and bind that Collection to the DataGrid.

private ObservableCollection<TagsCollection> GetTagsCollection(string colName)
        {
            ObservableCollection<TagsCollection> ocTags = new ObservableCollection<TagsCollection>();

                            foreach (string tag in GetTagsData)
                        {
                            if (DelimitedTagSet.Contains(tag.Trim()))
                            {
                                ocTags.Add(new TagsCollection { Tag = tag, IsSelected = true });
                            }
                            else
                            {
                                ocTags.Add(new TagsCollection { Tag = tag, IsSelected = false });
                            }                               
                        }
            return ocTags;
        }

Here’s what the xaml view looks like
enter image description here

  • 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-28T22:09:12+00:00Added an answer on May 28, 2026 at 10:09 pm

    Based on my understanding, the states you have to provide is a dynamic immutable list of options where you want to prompt user to enable/disable each of them, then return result as original string.

    If the list is a static list that you expect, for instance states, I’d surely suggest you having a list of states, and mapping against it.

    Make an Tag class that implement INotifyPropertyChanged, that has two props (name, selected) and remember to raise the PropertyChanged for each property change (I see it’s excluded from your code, I assume for brevity purposes).

    Make a List subclass, add a string constructor and override the ToString(), make all the parsing in this class and return the result on the ToString, then call it from you ViewModel.

    I now realize that you tagged the question with RIA, so why would you want to bind against that comma delimited string?

    You might want to expose the options in the server and treat it like this, so the client doesn’t know it’s a comma delimited.

    public class OptionsViewModel : ViewModelBase
    {
    
      public OptionsViewModel()
      {
         IsBusy = True;
         var context = new MyDomainContext();
         _Tags = context.Tags;
         //if called elsewhere but from ctor, make sure context.IsLoading is false;
         //The Load method is throwing an exception if re-loading when a load is on.
         //Debug.Assert(!context.IsLoading);
         context.Load(
            context.GetTagsQuery(),
            (op) =>
            {
              if(op.HasError && !op.IsErrorHandled) op.MarkErrorAsHandlere();
              IsBusy = false;
            },
            null);
      }
    
      private readonly Ienumerable<Tag> _Tags;
      public Ienumerable<Tag> Tags
      {
        get
        {
          return _Tags;
        }
      }
    
    }
    

    In the server expose an operation that returns that datacontract (of Tag) and the server should do the comma string parsing.

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

Sidebar

Related Questions

I'm trying to get a list of entity types that have been persisted as
I have a simple LINQ query on ADO.NET Entity Framework as follows var result
In my business model I have Entity class (IPoint interface ) that has a
I have an entity that maps to an external oracle table which is one
I have an entity class that has a property with an underlying db column
I have an entity that has a state table associated with it. The state
I have the following Post entity: public class Post { public string Id {get;set;}
I have a method that contains the following Linq to SQL code: public List<L2SBusinessEntities.Report.MesReport>
I have an entity named Affaire as below: [Key] public string IdAffaire { get;
I have an entity that looks like this: public partial class MemberTank { public

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.