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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T06:33:25+00:00 2026-06-09T06:33:25+00:00

I started using ComponentOne’s C1FlexGrid for my WPF Caliburn.Micro application. I wonder how I

  • 0

I started using ComponentOne’s C1FlexGrid for my WPF Caliburn.Micro application. I wonder how I can set with of the columns to the maximum contents width. I tried to make it Auto, but the width is still the same for all columns.

I applied AutoSizeColumns like this:

      protected override void OnViewAttached(object view, object context)
  {
      var View = (FirstDataEntryView)view;
      View.EnrollmentFiles.AutoSizeColumns(0, 4, 5);
  }

but this didn’t help…

Thanks

  • 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-09T06:33:27+00:00Added an answer on June 9, 2026 at 6:33 am

    Using GridLength.Auto usually doesn’t work for these column widths because of virtualization. FlexGrid has a couple methods to autosize the columns but the columns must be visible or they won’t be calculated and will remain the static width. Here is a very non-production-worthy example of how to do this. FWIW this is why I never liked ComponentOne controls — it felt like they were stuck in WinForms mode.

    edit: Adding some code for CM-specific usages.

    protected override void OnViewAttached(object view, object context) {
        View = (YourViewType)view;
        View.flexGrid.AutoSizeColumns(0,4,5);
    }
    

    As far as whether or not accessing the view from a viewmodel is “compliant” with MVVM theories — technically it is not, but sometimes you are forced to use controls that just cannot be automatically configured through XAML, and you can’t use the View’s code-behind because of one reason or another.

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

Sidebar

Related Questions

I started using rails_admin engine lately and can't quite figure out how I can
I started using NHibernate this week (struggling). I have a small application with 3
Just started using fadein/fadeout - it's functioning but with problems. I have a set
Just started using App Engine's webapp framework, but I can't figure out what's wrong
We started using C# (.NET 3.0) and I wonder how you guys are using
We started using Google Maps on our web application rather extensively. It worked fine
I started using Protobuf-Net in C# and WPF projects. I have a class that
I started using MVC3 and Rhino mocks. Can someone provide me an example to
I started using boost::thread recently (WinXP, VS10, BoostPro) and found that mutex can be
I started using RavenDB today. When I save a class, I can see the

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.