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)

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

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 on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
VERIFIED FIXED

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