[SOLVED] Is the DataBinding feature limited?

Please report bugs here. If you are unsure whether something is a bug or an expected behavior, please post it on the "Technical Support" forum instead, and wait for a moderator to handle/move the post.
cnayan
Posts: 7
Joined: Sat Oct 15, 2016 8:10 am

[SOLVED] Is the DataBinding feature limited?

Postby cnayan » Sun Oct 30, 2016 10:22 am

Hi,

When I try to bind the attached property, then there is compilation error reported. Why is that?

...
<Canvas Canvas.Left="{Binding LeftPanel.X}"
Canvas.Top="{Binding LeftPanel.Y}"

Background="Red" />
...

Error:
Severity Code Description Project File Line Suppression State
Error C#/XAML for HTML5: XamlPreprocessor (pass 2) failed: Property "Canvas" not found in type "Windows.UI.Xaml.Controls.Canvas". Note: the XAML editor sometimes raises errors that are misleading. To see only real non-misleading errors, make sure to close all the XAML editor windows/tabs before compiling. portApp1 C:\Visual Studio 2015\Projects\portApp1\portApp1\Views\MainPage.xaml 12


More details:

Code: Select all

<Page x:Class="portApp1.Views.MainPage"
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
      xmlns:local="using:portApp1"
      xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
      DataContext="{Binding MainViewModel, Source={StaticResource Locator}}"
      mc:Ignorable="d">
    <Grid Background="#FF00C000">
        <Canvas>
            <Canvas Canvas.Left="{Binding LeftPanel.X}"
                    Canvas.Top="{Binding LeftPanel.Y}"
                    Width="{Binding LeftPanel.Width}"
                    Height="{Binding LeftPanel.Height}"
                    Background="Red" />
        </Canvas>
    </Grid>
</Page>


Code: Select all

    class MainViewModel : ViewModelBase
    {
        LayoutManager _LayoutManager = new LayoutManager();

        public Rect LeftPanel
        {
            get { return _LayoutManager.Left; }
        }
    }


Code: Select all

    class LayoutManager : ViewModels.ViewModelBase
    {
        public Rect Left
        {
            get
            {
                var rectangle = new Rect
                {
                    Width = Screen.Width * 0.25f,
                    Height = Screen.Height
                };

                return rectangle;
            }
        }

        public Rect Screen
        {
            get { return Get<Rect>(); }
            set
            {
                Set(value);
            }
        }
    }

JS-Support @Userware
Site Admin
Posts: 1142
Joined: Tue Apr 08, 2014 3:42 pm

Re: Is the DataBinding feature limited?

Postby JS-Support @Userware » Mon Oct 31, 2016 3:53 am

Dear cnayan,

Thank you for reporting this issue. It indeed appears that the binding of Attached Properties does not work properly. We are going to fix it asap.

Thanks.
Regards,
JS-Support

cnayan
Posts: 7
Joined: Sat Oct 15, 2016 8:10 am

Re: Is the DataBinding feature limited?

Postby cnayan » Mon Oct 31, 2016 9:50 am

Thanks, team, for the acknowledgement!

Eagerly waiting for better upcoming version. 8-)

JS-Support @Userware
Site Admin
Posts: 1142
Joined: Tue Apr 08, 2014 3:42 pm

Re: Is the DataBinding feature limited?

Postby JS-Support @Userware » Sat Mar 04, 2017 6:19 pm

Hi,

We are pleased to inform you that this issue has been fixed in Beta 10.11 and newer.

You can download it from:
http://forums.cshtml5.com/viewforum.php?f=6

Thanks.
Regards,
JS-Support


Return to “Bug Reports”

Who is online

Users browsing this forum: No registered users and 29 guests