[Beta 8.3] PolyLineSegment doesn't initializes itself

Please post public support tickets here. Note: for private support tickets, please send an email to support@cshtml5.com instead.
xidea
Posts: 33
Joined: Thu Jun 30, 2016 7:04 pm

[Beta 8.3] PolyLineSegment doesn't initializes itself

Postby xidea » Fri Jul 01, 2016 10:04 am

Hi,

just coding for the first time with C#/XAML for HTML5.

I'm in trouble with the creation of a polyline. I've found the way using PolyLineSegment and adding to a Path.
When in runtime, I'm getting a "Null reference" error even if my PolyLineSegment must be not null, as instantiated with "new".

Pls see the screenshot of the debugger:

MAP-0000.jpg
MAP-0000.jpg (82.03 KiB) Viewed 12745 times


Same behaviour with PathFigure, PolyBezierSegment, and perhaps any object that have a collection of graphic elements as a property.

Any idea? Can I draw a polyline in some other way in meantime?

Thanks in advance.

Flavio

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

Re: [Beta 8.3] PolyLineSegment doesn't initializes itself

Postby JS-Support @Userware » Sat Jul 02, 2016 8:11 am

Thanks Flavio. We are going to investigate.

In the meantime, this is what you can do: since it works in XAML, and since XAML is transformed into C# at the beginning of the compilation process, you can have a look at how the generated C# code works for the <Path/> control. This will show you how to do the equivalent thing programmatically in C#. To do so, start by writing and testing some <Path/> control in XAML, then build the project, and look at the generated files under the "obj" subfolder of your project folder.

Regards
JS-Support

xidea
Posts: 33
Joined: Thu Jun 30, 2016 7:04 pm

Re: [Beta 8.3] PolyLineSegment doesn't initializes itself

Postby xidea » Sun Jul 03, 2016 12:40 am

Thanks for quick response,

I've investigated some tricks, and found that I can put a <Path ... ... > in the XAML markup and bind his Data property to a string containing the path coordinates in "mini language" as "Mx,y Lx1,y1 x2,y2 x3,y3 ...".

But neither this way is working at runtime, even if directly writing the Path markup in the XAML is effectively working (the thickness is ignored, though).

So I tried to investigate more, via Reflector, and at some point I encounter this line in the decompiled BindingExpression.cs:

MAP-0035.jpg
MAP-0035.jpg (201.73 KiB) Viewed 12740 times


There is two absign, I don't know if this is a result of poor decompilation, but I think it's not correct. There is no reason to assign to "walker" a boolean value :) x=y=z is  x=(y=z) .
edit: Obviously it's not true, sorry: x=y=z is not like x = y == z, so the code is correct, but in fact it refers to object that are null at runtime: a "Null reference" error is coming from that line, and if I correct the line deleting "= this.PropertyWalker" I again obtain a null reference, but the reason is that binding.INTERNAL_ComputedPath is null.

So I can't find a way to draw a path programatically and that is the only mandatory visual thing I need to implement.

I hope I've give you a clue for fixing.


Flavio
Last edited by xidea on Sun Jul 03, 2016 5:53 am, edited 2 times in total.

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

Re: [Beta 8.3] PolyLineSegment doesn't initializes itself

Postby JS-Support @Userware » Sun Jul 03, 2016 2:08 am

Thanks Flavio. We investigate.

In the meantime, did you have a look at the generated C# code in the "obj" folder ? You need to open for example "MainPage.g.cs" immediately after building the project. You will see how a normal XAML-defined <Path/> translates to equivalent C#.

Regards
JS-Support

xidea
Posts: 33
Joined: Thu Jun 30, 2016 7:04 pm

Re: [Beta 8.3] PolyLineSegment doesn't initializes itself

Postby xidea » Sun Jul 03, 2016 3:25 am

Hi,

just found another issue:

MAP-0033.jpg
MAP-0033.jpg (59.28 KiB) Viewed 12738 times


Any Thickness I will specify as Margin, the result is the ellipse is placed at 0,0.


I'll be glad to interact with your team in Italian (or English) via Skype, user: spiff967

Regards,


Flavio

xidea
Posts: 33
Joined: Thu Jun 30, 2016 7:04 pm

Re: [Beta 8.3] PolyLineSegment doesn't initializes itself

Postby xidea » Sun Jul 03, 2016 6:38 am

JS-Support wrote:Thanks Flavio. We investigate.

In the meantime, did you have a look at the generated C# code in the "obj" folder ? You need to open for example "MainPage.g.cs" immediately after building the project. You will see how a normal XAML-defined <Path/> translates to equivalent C#.

Regards
JS-Support


Yes, the g.cs contains the code, but there the generated app's dll when decompiled shows a more clean code:

Code: Select all

 path.Data = (Geometry) TypeFromStringConverters.ConvertFromInvariantString(typeof(Geometry), "M 45,45 L 135,45 135,135 215,135");
       


So, using the mini language for drawing is a possible way to do it.

Tested, the code works, however I confirm that Thickness is bypassed (ever = 1), programmatically and by markup. No way to obtain thick lines. I think the problem is on JS side, as the thicknes is correctly rendered in the VS's Design View.


Waiting for updates, Many Thanks


Flavio

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

Re: [Beta 8.3] PolyLineSegment doesn't initializes itself

Postby JS-Support @Userware » Fri Jul 08, 2016 11:05 am

Hi Flavio,

The issue related to StrokeThickness being ignored is now supposed to be fixed in Beta 8.4, available at:

http://forums.cshtml5.com/viewtopic.php?f=6&t=5498

Can you please confirm that it fixes the issue for you?

Thank you.
Regards,
JS-Support

xidea
Posts: 33
Joined: Thu Jun 30, 2016 7:04 pm

Re: [Beta 8.3] PolyLineSegment doesn't initializes itself

Postby xidea » Sat Jul 09, 2016 11:17 am

Yes, now the thickness is correctly rendered, but the point of the path are not correctly positioned. The stroke caps (setted as round, are rendered flat), and any shape is lways positioned in 0,0 ignoring the specified coords.

In this example, you can see in yellow the correct path and shape vs in blue the rendered path and shape. The 0,0 issue comes up for any shape (I've tested oval and rectangle).

MAP-0001.jpg
MAP-0001.jpg (75.56 KiB) Viewed 12697 times


The path is drawn by using programmatically the mini-language, the shape is placed programmatically too.

Waiting for any news, as my project is somehow simple but breaked by these issue (and other) issues.


Regards

Flavio.

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

Re: [Beta 8.3] PolyLineSegment doesn't initializes itself

Postby JS-Support @Userware » Sun Jul 10, 2016 1:19 am

Hi Flavio,

Thanks. Glad to know that the thickness now renders correctly, and sorry for the remaining issues. We are little by little fixing all of them, and we hope to be able to get out of Beta soon.

For the positioning issue, would you mind please posting just a small piece of XAML or programmatic code to reproduce the exact issue? This will help speed up the resolution and ensure that we test the correct scenario before posting any fix.

Also, you mentioned other issues that are breaking your project. Can you please let us know about each of them? Please either submit tickets to support@cshtml5.com or by create new topics on these forums. We are doing our best to fix all the remaining issues.

Thanks again.

Regards
JS-Support

xidea
Posts: 33
Joined: Thu Jun 30, 2016 7:04 pm

Re: [Beta 8.3] PolyLineSegment doesn't initializes itself

Postby xidea » Sun Jul 10, 2016 6:50 am

Hi,

just realized that the issue is about managing the margins of a shape contained in a canvas object, and you can reproduce it even in XAML:

Code: Select all

<Page
    x:Class="Application1.MainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="clr-namespace:Application1"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d">
    <Canvas>
        <Grid>
            <TextBlock Text="Hello World!" x:Name="TextBlock1" Canvas.Left="20" Canvas.Top="30"/>
            <Rectangle Width="30" Height="30" Fill="#AAAAAAAA" Margin="30 "/>
            <Canvas x:Name="myCanvas">
                <Ellipse Fill="#FF101010" Width="40" Height="40" Margin=" 100,100,0,0"/>
            </Canvas>
        </Grid>
    </Canvas>
</Page>


MAP-0002.jpg
MAP-0002.jpg (19.9 KiB) Viewed 12684 times


The page rendering in the simulator places correctly the rectangle that stays out of the canvas, but places the ellipse at 0,0 within the canvas.

IMHO the textbox too is wrongly placed.


Regards

Flavio


Return to “Technical Support”

Who is online

Users browsing this forum: No registered users and 25 guests

 

 

cron