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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T12:33:21+00:00 2026-06-14T12:33:21+00:00

I am using CefSharp in my WPF project. I’m adding the CefSharp.Wpf.WebView class to

  • 0

I am using CefSharp in my WPF project. I’m adding the CefSharp.Wpf.WebView class to my MainWindow.xaml like so:

_webView = new WebView(url, _settings);

My XAML layout looks like this:

<Window x:Class="WPFContainer.MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="Test Project" Height="400" Width="930" Initialized="OnWindowInit" StateChanged="OnWindowStateChanged" Closing="OnWindowClose">
  <DockPanel Name="MainDockPanel" Height="400" Width="930">
    <Grid VerticalAlignment="Top" HorizontalAlignment="Left" ShowGridLines="True" Name="mainGrid" >
        <Grid.ColumnDefinitions>
            <ColumnDefinition Name="col1" Width="600" />
            <ColumnDefinition Name="col2" Width="330"/>
        </Grid.ColumnDefinitions>
    </Grid>
  </DockPanel>
</Window>

If I remove the Grid and add the webView to the DockPanel directly, it shows up just fine. But if I try to add the webView to col1 in the Grid, it doesn’t display. It will display in the grid column if I specify a Width/Height, but HorizontalAlignment.Stretch doesnt work and I need 100% width and height!

My code for adding the webView to the Grid which doesn’t work:

mainGrid.Children.Add(_webView);
Grid.SetColumn(_webView, 0);
  • 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-14T12:33:23+00:00Added an answer on June 14, 2026 at 12:33 pm

    The problem is that the Children property is populated in InitializeComponent. If you are adding children to the grid after it has been initialize, there is no property changed event for adding to the Children collection, as it is not an ObservableCollection. If you were to create a new collection I believe it would work programmatically, but that can be avoided by defining your webview in xaml (provided it has a paramaterless constructor). Then OnLoaded you can inject url and settings.

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

Sidebar

Related Questions

(Using MVC 2) From inside my controller action, I need to display the url:
Using python-requests and python-magic, I would like to test the mime-type of a web
Using Jenkins or Hudson I would like to create a pipeline of builds with
Using Rails 3.2.0 with haml and sass: I Would like to link an external
Using WPF/PRISM I want to log my messages through ILoggerFacade to my GUI (A
Using the new mvc4 now gives us access to use facebook oauth otb. I
Using JNotify in project and it fulfill my all requirements, but some times it
Using JDeveloper , I started developing a set of web pages for a project
Using C#, I need a class called User that has a username, password, active
Using preview 4 of ASP.NET MVC Code like: <%= Html.CheckBox( myCheckBox, Click Here, True,

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.