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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T12:52:15+00:00 2026-06-15T12:52:15+00:00

I am developing a screen, and this screen I have a grid. Within this

  • 0

I am developing a screen, and this screen I have a grid. Within this grid, I have a UserControl WebBrowser. I’m using this component to display XML formatted and syntax is highlighted (with color). The text to be displayed is done via Binding, so that the component is a UserControl, as was done for the same modifications accepted Binding (since the original does not accept content via Binding). But I’m experiencing the following problem: when the user resizes the screen of the program at a certain point, the body of the WebBrowser beyond the boundaries of the grid, making the screen is strange at the bottom of the Grid.
I tested with other components, and this problem does not occur.

Behold my UserControl:

<UserControl x: Class = "Geraes.Library.Core.GUI.WPF.Controls.XmlBrowserControl" 
xmlns = "http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns: x = "http://schemas.microsoft.com/winfx/2006/xaml"
x: Name = "thisControl">
   <Grid Margin="0,0,0,0" VerticalAlignment="Stretch" HorizontalAlignment="Stretch">
     <WebBrowser Name="WebBrowser" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" />
   </ Grid>
</ UserControl>

And here, how I use it:

<ct:XmlBrowserControl XmlDoc="{Binding ContentString}" Grid.Row="1" />

Again, I can’t understand why this is happening, since other components works as well inside this grid.

Another thing: we’re using WebBrowser because until this moment, it’s the best component to show a XML formatted and with syntax-colour. But if you know another one than its better and easy to use, i’m accepting suggestions.
Any help is welcome.

Best regards,
Gustavo.

  • 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-15T12:52:17+00:00Added an answer on June 15, 2026 at 12:52 pm

    I was having a similar problem using the webbrowser control, in the end I switched to using awesomium and have found it much nicer to use.

    I wanted to size the content of the webbrowser (or webcontrol) to fit content without scroll bars so I could use the scrollbars of the containing element (in my case a grid). I also started with a custom control but then switched to adding the the binding source as an attached property instead and setting the sizes and visibility once the content had loaded. I my case I was using you localing stored html string, but you could use a uri instead

    using System;
    using System.Windows;
    using Awesomium.Windows.Controls;
    using Awesomium.Core;
    
    namespace utilities
    {
    
        public class WebBrowserHelper {
    
            public static readonly DependencyProperty BodyProperty =
                DependencyProperty.RegisterAttached("Body", typeof (string), typeof(WebBrowserHelper), new PropertyMetadata(OnBodyChanged));
    
            public static string GetBody(DependencyObject dependencyObject) {
                return (string) dependencyObject.GetValue(BodyProperty);
            }
    
            public static void SetBody(DependencyObject dependencyObject, string body) {
                dependencyObject.SetValue(BodyProperty, body);
            }
    
            private static void ScrollDataReceivedDelegate(object sender, ScrollDataEventArgs e)
            {
                var webControl = (Awesomium.Windows.Controls.WebControl) sender;
                webControl.Height = e.ScrollData.ContentHeight;
                webControl.Width = e.ScrollData.ContentWidth;
                webControl.Visibility = Visibility.Visible;
            }
    
            private static void OnBodyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) {
                var webControl = (Awesomium.Windows.Controls.WebControl) d;
                webControl.LoadHTML((string)e.NewValue);
                webControl.ScrollDataReceived += new ScrollDataReceivedEventHandler(ScrollDataReceivedDelegate);
                webControl.LoadCompleted += delegate {
                    webControl.RequestScrollData();
                };
            }
        }
    }
    

    And the namespaces:

    xmlns:utilities="clr-namespace:utilities;assembly=utilities"
    xmlns:awesome="clr-namespace:Awesomium.Windows.Controls;assembly=Awesomium.Windows.Controls"
    

    And the xaml:

    <awesome:WebControl 
        HorizontalAlignment="Left" 
        Width="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type Grid}}, Path=ActualWidth}" 
        Height="1" 
        utilities:WebBrowserHelper.Body="{Binding html}" 
        Visibility="Collapsed" />
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am developing MVC 3 application and using razor syntax. In this application I
I am developing an UI(Home screen) just like this screen given in this link
I am developing a screen in c# dot net where i have a search
I am developing a lock screen in my application and i have the same
I am developing a j2me map based application. Screen is divided into a grid
I am developing an application using WPF. The app runs full screen, and I
In the app I am currently developing, I have to implement a screen which
I'm currently developing a touch screen application using C# (.NET 4.0) and WPF for
I am developing a mobile web app. Currently I have this snippet of jQuery
I am developing a programme using python & wxPython. I have a listbox, and

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.