Bug 60767 - Setting Grid RowDefinition.Height to DynamicResource doesn't work
Summary: Setting Grid RowDefinition.Height to DynamicResource doesn't work
Status: CONFIRMED
Alias: None
Product: Forms
Classification: Xamarin
Component: Forms ()
Version: 2.5.0
Hardware: PC Windows
: Normal normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2017-11-20 12:03 UTC by Dominik Weber
Modified: 2017-11-20 20:02 UTC (History)
2 users (show)

Tags: grid, rowdefinition, dynamicresource, ac
Is this bug a regression?: ---
Last known good build:


Attachments
test project (302.70 KB, application/x-zip-compressed)
2017-11-20 12:03 UTC, Dominik Weber
Details


Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report for Bug 60767 on Developer Community or GitHub if you have new information to add and do not yet see a matching new report.

If the latest results still closely match this report, you can use the original description:

  • Export the original title and description: Developer Community HTML or GitHub Markdown
  • Copy the title and description into the new report. Adjust them to be up-to-date if needed.
  • Add your new information.

In special cases on GitHub you might also want the comments: GitHub Markdown with public comments

Related Links:
Status:
CONFIRMED

Description Dominik Weber 2017-11-20 12:03:12 UTC
Created attachment 25759 [details]
test project

When setting RowDefinition.Height to {DynamicResource MyResource} using XAML the height setting seems to be ignored.
Using StaticResource instead of DynamicResource works fine, however without dynamic changes. I have also tried using a Binding to specify RowDefinition.Height which does work and also accounts for dynamic changes.


-- App.xaml ----------------------------
  <Application.Resources>
    <ResourceDictionary>
      <GridLength x:Key="MySize">100</GridLength>
    </ResourceDictionary>
  </Application.Resources>



-- MainPage.xaml -----------------------
    <StackLayout>

      <Grid>
        <Grid.RowDefinitions>
          <RowDefinition Height="{StaticResource MySize}" />
        </Grid.RowDefinitions>
        <Label BackgroundColor="LightBlue" Text="StaticResource" />
      </Grid>

      <Grid>
        <Grid.RowDefinitions>
          <RowDefinition Height="{DynamicResource MySize}" />
        </Grid.RowDefinitions>
        <Label BackgroundColor="LightSalmon" Text="DynamicResource" />
      </Grid>

      <Grid>
        <Grid.RowDefinitions>
          <RowDefinition Height="{Binding MySize}" />
        </Grid.RowDefinitions>
        <Label BackgroundColor="LightYellow" Text="Binding" />
      </Grid>

    </StackLayout>

Expected behavior: All labels initially are 100px in height (MySize property contains the same value as the MySize resource). When the MySize resource (and property) is changed the 2nd and 3rd label should change their size.

Actual behavior: Only the StaticResource and Binding labels are 100px initially, the DynamicResource label is autosized to fit its text. When the MySize resource and property are changed, only the 3rd label using data binding is updated.

Test project attached.
Comment 1 Paul DiPietro [MSFT] 2017-11-20 20:02:53 UTC
Will set to confirmed until further investigation can be made to determine if this is expected or not.