-
Notifications
You must be signed in to change notification settings - Fork 137
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make SvgDrawingCanvas Drawings public #88
Comments
SvgDrawingCanvas is based on an initial work for a customer, before the library was made public. That is why most parts are commented out. Now, what is the actual requirements of your project? Do you need the SvgDrawingCanvas? SvgDrawingCanvas is only useful if you separate the processes; conversion and viewing. The initial requirement for a car wiring manual, converts all the SVG files to XAML files and combine with documentations/instructions in FlowDocument XAML to create an interactive WPF-based manual. So the SvgDrawingCanvas was for the viewing application at the end-users, the conversion library was not shipped to the end-users; only the Runtime library. |
I think it's great that you bring the library back to life and continue to develop! 😀👍 In my project I have a plant visualization! From SolidWorks I can export individual modules as SVG. This makes it possible to implement the layout 1: 1 in my C # application without much effort. Since it is also possible to select individual stations, I have to color my modules. Therefore, I need access to the individual elements of the SVG. In detail I have a <Grid>
<svgc:SvgViewbox x:Name="backgroundSvg" Source="4H040339_bg.svg"/>
<svgc:SvgViewbox x:Name="svg" Source="4H040339.svg"/>
</Grid> As an additional improovement would be to get acces to a named layer inside of the svg. So I could have 2 layer inside of my svg and only color the "background_layer". This could save me a EDIT You wrote: SvgDrawingCanvas is only useful if you separate the processes It would be amazing if it is possible to let the |
Thanks for the compliments, happy to know this library is useful to your works.
Will modify the controls to allow access to the loaded SVG document, will drop the use of converter classes in the controls.
You can loop through the drawings in the DrawingGroup to find the background_layer. Layers are converted to DrawingGroup in the drawings.
The library does not impose any application framework, the SvgDrawingCanvas does not handle conversions, these are handled by the SvgConverter derived classes. The converter classes can be ran in a different thread and even in different .NET domain. The controls such as SvgViewbox and SvgCanvas do handle conversions, so we could support background conversion here including support for async/await procedures in .NET45 versions. Just for information, do you have animations in the SVG files? |
I do not understand exactly what you want to tell me
I wonder just if it is also possible to specify the contour, since currently only the background (of the svg) is bound to the
That's a good solution! Then the gui would be much more response! Actually I have more than 4seconds until the Page has been loaded..
It is very simple. I made a foreach (Drawing drawing in drawings)
{
if (drawing is GeometryDrawing geometryDrawing)
{
BindingOperations.SetBinding(geometryDrawing, GeometryDrawing.BrushProperty, fillBinding);
}
} |
I think we need more documentations of the library features since mode is being added. Basically, you can modify the SVG DOM if the Svg Document object is exposed. It is an instance of XmlDocument, so you can query, modify etc.
Personally, I think the layer could make the work clearer. Design tools allow layer creation so the flow will be natural.
You only need more access to the created Drawing objects, will commit those changes soon. |
This exposes the converted drawings through public properties in both the controls. Fix for issue #88
@dojo90 Please see if this commit addresses your needs 6eec555 |
But that means you have to 'redraw'/'render' the svg after modifing the source. For my personal needs, it's enough to get access to each object of the rendered svg. Maybe other people want to modify the svg via their app. With your last commit 6eec555 a developer has access to all the rendered objects. That is exactly what I was asking for 😎 👍
Could you please take a look at this quote |
@dojo90 Hi, I am looking for a way to change svg foreground color and I just saw your solution in here. |
After a couple research, I found my solution. It is reference to @dojo90 's sample code, but it don't need to add code on code-behind. Just create a custom dependency property and bind it.
|
Sorry to reserruct this issue, but is there a plan to include this feature into SvgViewbox? If so, you might find the folllowing implementation useful as it also allows for overriding the svg's stroke color.
|
@stojy Do you mean the binding operations suggested by @Lak4CYUT? You can post a new issue with your suggestions and reference this one. |
@paulushub, that's correct.. I was referring to @Lak4CYUT's binding suggestion. I'll make a fresh posting as suggested. |
Actually I want to change the color of the svg via XAML or code behind. Due to the
private
modifier, it is not possible to access the objects (see: https://github.com/ElinamLLC/SharpVectors/blob/master/Source/SharpVectorRuntimeWpf/SvgDrawingCanvas.cs#L49).I found a possibility to get it working via reflection:
Is there a special reason why they are
private
?The text was updated successfully, but these errors were encountered: