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 9224573
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T04:21:23+00:00 2026-06-18T04:21:23+00:00

Just starting out with ReactiveUI. I am basically populating a grid with the results

  • 0

Just starting out with ReactiveUI. I am basically populating a grid with the results of a query. My viewmodel currently looks like this.

 public class QueryViewModel : ViewModelBase 
{

    private readonly ResultSet _resultSet = null;

    public ReactiveCollection<GridColumn> Columns { get; private set; }
    public ReactiveCollection<GridRow> Rows { get; private set; }

    public QueryViewModel()
    {
        _resultSet = ... run query

        Columns = new ReactiveCollection<GridColumn>(from c in _resultSet.Columns select new GridColumn(c));
        Rows = new ReactiveCollection<GridRow>(from r in _resultSet.Rows select new GridRow(r));

        //Rows = new ReactiveCollection<GridRow>();
        //_resultSet.ObservableRows
        //          .Subscribe(r => Rows.Add(new GridRow(r)));                     

    }    
}

As you can see I can get it working when populating using an IEnumerable, but you can see from the commented out bit that I’m not quite sure of the way to populate from an IObservable.

Any chance someone could point me in the right direction, please.

EDIT:

For full disclosure, I’ve included the implementation of ObservableRows in case I’m making a mistake here.

Return Observable.Create<Row>((o) => {
             var cn = New SqlConnection(connection);
             var cmd = New SqlCommand(sql, cn);
             var asyncReader = Observable.FromAsyncPattern<SqlDataReader>(cmd.BeginExecuteReader, cmd.EndExecuteReader);
             IDisposable subscription;
             Try {
                cn.Open();
                subscription = asyncReader().Subscribe(rdr => PublishRows(rdr, o, columns));
             }
             Catch Exception ex {
                o.OnError(ex);
             }

             Return Disposable.Create(() => { 
                  subscription.Dispose();
                  cmd.Dispose();
                  cn.Close();
                  cn.Dispose();
             });
}

Many thx

S

  • 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-06-18T04:21:24+00:00Added an answer on June 18, 2026 at 4:21 am

    How about:

    Rows = _resultSet.ObservableRows.CreateCollection();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Just starting out with HAML, how do I convert this? <div class=fb-like data-href=http://localhost:3000 data-send=true
Just starting out, this should be a simple one but I haven't been able
I am just starting out on functions in PostgreSQL, and this is probably pretty
Just starting out with C#, so this may be overly simple that I keep
I'm just starting out writing this code and when I add in the db
Im just starting out with wpf (in blend 4) and i would like to
I am just starting out with Python and decided to try this little project
just starting out with this: My PhoneGap app at some point uploads images to
Just starting out with Andengine. I used this blog to install the basic AndEngine
Just starting out with bash and I'm having a little trouble getting this script

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.