[Proposal] DrawingView
See original GitHub issueDrawingView
- Proposed
- Prototype
- Implementation
- iOS Support
- Android Support
- macOS Support
- Windows Support
- Unit Tests
- Sample
- Documentation
Summary
Allows you to draw one or multiple lines on a canvas
Detailed Design
DrawingView.shared.cs
public class DrawingView : View
{
public static readonly BindableProperty ClearOnFinishProperty;
public static readonly BindableProperty MultiLineModeProperty;
public static readonly BindableProperty LinesProperty;
public static readonly BindableProperty DrawingLineCompletedCommandProperty;
public static readonly BindableProperty DefaultLineColorProperty;
public static readonly BindableProperty DefaultLineWidthProperty;
public event EventHandler<DrawingLineCompletedEventArgs>? DrawingLineCompleted;
public Color DefaultLineColor { get; set; }
public float DefaultLineWidth { get; set; }
public ICommand? DrawingLineCompletedCommand { get; set; }
public ObservableCollection<Line> Lines { get; set; }
public bool MultiLineMode { get; set; }
public bool ClearOnFinish { get; set; }
public Stream GetImageStream(double imageSizeWidth, double imageSizeHeight);
public static Stream GetImageStream(IEnumerable<Line> lines, Size imageSize, Color backgroundColor);
}
Usage Syntax
XAML Usage
<views:DrawingView x:Name="DrawingViewControl"
BackgroundColor="LightGray"
HeightRequest="200"
DefaultLineColor="Red"
DefaultLineWidth="3"
Lines="{Binding Lines, Mode=TwoWay}"
ClearOnFinish="{Binding Source={x:Reference ClearOnFinish}, Path=IsToggled}"
MultiLineMode="{Binding Source={x:Reference MultiLineMode}, Path=IsToggled}"/>
C# Usage
new DrawingView
{
BackgroundColor = Colors.LightGray,
HeightRequest = 200,
DefaultLineColor = Colors.Red,
DefaultLineWidth = 3
}.Bind(DrawingView.Lines, nameof(ViewModel.Lines))
.Bind(DrawingView.ClearOnFinish, nameof(ViewModel.ShouldClear))
.Bind(DrawingView.MultiLineMode, nameof(ViewModel.ShouldAllowMultiLine));
Alternatives
Might be a duplicate of Microsoft.Maui.Graphics
?
Unresolved Questions
Is DrawingView
still necessary? Or has it been superseded by Microsoft.Maui.Graphics
?
Issue Analytics
- State:
- Created 2 years ago
- Comments:9 (2 by maintainers)
Top Results From Across the Web
CommunityToolkit/docs/maui/views/DrawingView.md at main
The DrawingView provides a surface that allows for the drawing of lines through the use of touch or mouse interaction.
Read more >Save an Image from .NET MAUI Community Toolkit ... - YouTube
With the .NET MAUI Community Toolkit DrawingView you can let your creativity go free! Or, just capture boring signatures.
Read more >How to use CommunityToolkit.Maui DrawingView inside of ...
In .NET MAUI Blazor , I tried to use the Drawing View in .razor page . ... I would suggest that you can...
Read more >Saving and loading ink content from DrawView
Hello. I am writing an app on C# using MAUI, after some years without seriously touching C#, so I am a ittle rusty....
Read more >Island on the Fence: drawing: view of proposal model ...
Island on the Fence: drawing: view of proposal model: floating island with border fence in background. Isla en la muralla.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I think could be part of the Toolkit or maybe also of .NET MAUI Graphics. What does make sense to me is directly use Maui Graphics in GraphicsView. Could simplified the code and at the end benefits also Graphics.
Reopening Proposal.
Only Proposals moved to the
Closed
Project Column andCompleted
Project Column can be closed.