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

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