question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Binding to ActualWidth

See original GitHub issue

Quick question: Is binding to ActualWidth supported?

  <StackPanel>
    <Grid ColumnDefinitions="300">
      <Button Name="Test" Content="Hello"></Button>
    </Grid>

    <Button Content="World" Width="{Binding #Test.ActualWidth}"></Button>
  </StackPanel>

The second button should have a width of 300 now, but it’s NaN instead. What am I missing out?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:18 (11 by maintainers)

github_iconTop GitHub Comments

7reactions
wieslawsoltescommented, Nov 30, 2018

Use Bounds.Width instead.

1reaction
grokyscommented, Nov 30, 2018

Ah, I didn’t notice that one. Ok, I will close this and assign myself to that issue, hope that’s ok. Will fix asap.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to bind to a control's literal actual width (including its ...
There is no way of doing this through binding because the ActualWidth property doesn't include the margin as already stated.
Read more >
Binding to ActualWidth property returns 0 at runtime - Forums
Hello, I am working on a top bar that displays currencies. It should stretch its inner part based on text width, so I...
Read more >
FrameworkElement.ActualWidth Property - UWP
For purposes of ElementName binding, ActualWidth does not post updates when it changes (due to its asynchronous and run-time calculated nature).
Read more >
Adding support for bindable ActualHeight/ActualWidth of ...
I read somewhere that binding to ActualHeight is not a good idea because it can cause issues with UpdateLayout mechanisms not knowing when...
Read more >
Simple Behavior for Binding to ActualWidth or ActualHeight
to mitigate the problem I created a simple Behavior that enables binding to another element ActualHeight and ActualWidth.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found