You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Originally posted by kucint July 2, 2024
Create a simple Control that uses Path as Template:
Path is just a simple line between two points that are represented by dependency properties: StartHotspot and EndHotspot
publicMainPage()=>this.DataContext(newBindableMainPageModel(),(page,vm)=>page.Background(ThemeResource.Get<Brush>("ApplicationPageBackgroundThemeBrush")).Content(newStackPanel().VerticalAlignment(VerticalAlignment.Center).HorizontalAlignment(HorizontalAlignment.Center).Children(newTextBlock().Text("Hello Uno Platform!"),// implementing Path directly works fine:newPath().Stroke(Colors.DarkGreen).StrokeThickness(3).Data(newPathGeometry().Figures(newPathFigureCollection(){newPathFigure().StartPoint(newPoint(10,10)).Segments(newPathSegmentCollection(){newLineSegment().Point(newPoint(80,30))})})),// implementing Path bound to MVU model works fine:newPath().Stroke(Colors.HotPink).StrokeThickness(3).Data(newPathGeometry().Figures(newPathFigureCollection(){newPathFigure().StartPoint(()=>vm.StartPoint).Segments(newPathSegmentCollection(){newLineSegment().Point(()=>vm.EndPoint)})})),// implementing Path inside MyControl bound to control's properties fails:newMyControl().StartHotspot(newPoint(10,30)).EndHotspot(newPoint(80,50)))));
under net8.0-desktop; following exception is thrown: Exception thrown: 'System.InvalidCastException' in Uno.Extensions.Markup.dll
Unable to cast object of type 'Microsoft.UI.Xaml.Media.PathFigure' to type 'Microsoft.UI.Xaml.FrameworkElement'.
under net8.0-windows10.0.19041; following exception is thrown: No installed components were detected.
Cannot apply a Style with TargetType 'Microsoft.UI.Xaml.Controls.ControlTemplate' to an object of type 'UnoPathApp.Controls.MyControl'.
Note that the following fix has been applied: Setting styles in templated control causes control to crash under windows #2316
Discussed in #2405
Originally posted by kucint July 2, 2024
Create a simple Control that uses
Path
asTemplate
:Path is just a simple line between two points that are represented by dependency properties:
StartHotspot
andEndHotspot
The control is now consumed in a frame:
Environment:
under
net8.0-desktop;
following exception is thrown:Exception thrown: 'System.InvalidCastException' in Uno.Extensions.Markup.dll
Unable to cast object of type 'Microsoft.UI.Xaml.Media.PathFigure' to type 'Microsoft.UI.Xaml.FrameworkElement'.
under
net8.0-windows10.0.19041;
following exception is thrown:No installed components were detected.
Cannot apply a Style with TargetType 'Microsoft.UI.Xaml.Controls.ControlTemplate' to an object of type 'UnoPathApp.Controls.MyControl'.
Note that the following fix has been applied:
Setting styles in templated control causes control to crash under windows #2316
repro: UnoPathApp.zip
The text was updated successfully, but these errors were encountered: