Bug 55096 - {x:Static} with nested class does not work on XAML.
Summary: {x:Static} with nested class does not work on XAML.
Status: VERIFIED FIXED
Alias: None
Product: Forms
Classification: Xamarin
Component: Forms (show other bugs)
Version: 2.3.4
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Stephane Delcroix
URL:
Depends on:
Blocks:
 
Reported: 2017-04-12 15:08 UTC by IZILABS Software
Modified: 2017-07-19 09:24 UTC (History)
7 users (show)

See Also:
Tags: xamlc
Is this bug a regression?: Yes
Last known good build: 2.3.2.127


Attachments

Description IZILABS Software 2017-04-12 15:08:54 UTC
Binding with nested class does not working on XAML.

Example:

public static class Car
{
    public static class Wheel
    {
        int value = 20;
    }
}

<?xml version="1.0" encoding="utf-8" ?>
<Grid xmlns="http://xamarin.com/schemas/2014/forms"
   xmlns:LibStatic="clr-namespace:com.car.Lib;assembly=com.car.Lib">

  <Label FontSize="{x:Static LibStatic:Car+Wheel.value}" />

</Grid>

I'm gettting the error "Type Car+Wheel not found in xmlns clr-namespace:com.car.Lib;assembly=com.car.Lib"
Comment 1 Stephane Delcroix 2017-04-18 07:57:20 UTC
this isn't a Binding, it's a reference to a static path. Also, `value` isn't public. But I get the idea.
Comment 2 Stephane Delcroix 2017-04-18 09:51:38 UTC
https://github.com/xamarin/Xamarin.Forms/pull/872
Comment 3 Samantha Houts [MSFT] 2017-05-20 16:02:41 UTC
Should be fixed in 2.3.4 SR2. Thank you!
Comment 4 Neha Kharbade 2017-07-04 06:57:44 UTC
Hi,

Can anyone please help me for verifying the fix being applied in above bug. Any Steps to reproduce the bug would be great.

Thanks in advance.
Comment 5 Saurabh Paunikar 2017-07-19 09:24:27 UTC
Used x:Static with nested class to set text of a lable.Verified on xamarin version 2.3.5.256-pre-6.

code in xaml

<Label  
           VerticalOptions="Center" 
           HorizontalOptions="Center" 
           Text="{x:Static local:Car+Wheel.value}"/>


code in xaml.cs

public static class Car
    {
        public static class Wheel
        {
            static string value = "20";
        }
    }

ScreenCast link :https://www.screencast.com/t/FBEeCpoi

Notice (2018-05-21): bugzilla.xamarin.com will be switching to read-only mode on Thursday, 2018-05-25 22:00 UTC.

Please join us on Visual Studio Developer Community and GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs and copy them to the new locations as needed for follow-up. The See Also field on each Bugzilla bug will be updated with a link to its new location when applicable.

After Bugzilla is read-only, if you have new information to add for a bug that does not yet have a matching issue on Developer Community or GitHub, you can create a follow-up issue in the new location. Copy and paste the title and description from this bug, and then add your new details. You can get a pre-formatted version of the title and description here:

In special cases you might also want the comments:

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.

Note You need to log in before you can comment on or make changes to this bug.