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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T10:33:16+00:00 2026-05-23T10:33:16+00:00

I am trying to bind ChildWindow Height property to my viewmodel property , but

  • 0

I am trying to bind ChildWindow Height property to my viewmodel property , but I think it only reads VM value on first load and doesn’t change size when VM changes & notifies about the change. In debugger I see that it goes into Height getter once, further notifications don’t change ChildWindow size..

I think it should be bindable so I am wondering whether some issue exists here or I am doing some mistake?

Sounds like one time binding, but its oneway..

Height="{Binding WindowHeight,Mode=OneWay}" 

Further investigation shows that when we change binding to Mode=TwoWay and add an empty setter it begins to behave as expected. But that doesn’t explain the reason why OneWay binding doesn’t work. Also value that is passed to setter is equal to my whole application height, not just childwindow that is obviously supposed to be smaller.

The most strange thing with this whole situation is the following:

Also this value is passed to setter
4 consecutive times everytime after a getter is called (see
count++ that is used to count that).

It is fired before dialog is actually shown, and it always goes in sequence get,set,set,set,set

Code for view model is super simple. Nowhere in code anyone is using ChildWindow Height, its only set in its xaml binding as shown above.

    private int count = 0;
    public int WindowHeight
    {
        get { return IsDefaultMode? DEFAULT_HEIGHT : SPECIAL_HEIGHT; }
        set {count++; }
    }

My inheriting Childwindow class contains like 5 strings of text none of which affect Height in any way.

Notification about WindowHeight is not fired by WindowHeight property (as seen in code) , its fired by Mode property. Couldve been a converter around mode but its currently implemented this way cause I am not sure a special converter with a couple of magic values for this situation is a better approach.

oks . mode setter code:

public bool IsSpecialMode
        {
            get { return m_IsSpecialMode; }
            set
            {
                if (m_IsSpecialMode!= value) 
                {
                    m_IsSpecialMode= value;
                    NotifyPropertyChanged("IsSpecialMode");
                    NotifyPropertyChanged("WindowHeight");
                }
            }
        }
  • 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-23T10:33:17+00:00Added an answer on May 23, 2026 at 10:33 am

    If the ChildWindow, or any other object, changes the Height property then your binding will be lost. Try setting it to a TwoWay binding and set a break point in your View-model’s WindowHeight property’s setter. That will tell you what is setting it and whether you can have a OneWay binding.

    The ChildWindow class will actually set it’s own Height and Width properties. For example, the following code ensures the ChildWindow always covers the root content of your application. This allows the ChildWindow to provide the overlay or faded effect when showing it’s popup:

    private void UpdateOverlaySize()
    {
        if (((this.Overlay != null) && (Application.Current != null)) && ((Application.Current.Host != null) && (Application.Current.Host.Content != null)))
        {
            base.Height = Application.Current.Host.Content.ActualHeight;
            base.Width = Application.Current.Host.Content.ActualWidth;
            // ... other code removed
        }
    }
    

    So if effect, it looks like you can’t use a OneWay binding on the Height or Width properties.

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

Sidebar

Related Questions

I'm trying to bind parameters in what I think is the correct way, but
I'm trying to bind a XML to POJOs using Simpleframework but it doesn't work
I'm trying to bind to the ActualWidth of a column but the binding doesn't
I am trying to bind(select) the some data by value from my list but
I'm trying to bind dropdownlist(inside jqxgrid cell) to database, but change event for dropdownlist
I'm trying to bind a list of data to a data grid, but can't
Hi I'm trying to bind data to a kendochart, but no bars are appearing
FindAncestor RelativeSource only supports 'Self' and 'TemplatedParent', but I have to bind the width
I'm trying to bind the selected value from the date picker to an asp
I am trying to bind a property of an element within a UserControl to

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.