Comments (4)
Hi, if you use LoadFromResource
the Resource Name is the Namespace + fileName, it is not a path.
e.x. Svg.FontAwesomeSvg.LoadFromResource("FontAwesome6.Example.WPF.Svg.FontAwesomeSvg.all.json", Assembly.GetExecutingAssembly());
"FontAwesome6.Example.WPF" < this is the default Namespace from the "FontAwesome6.Example.WPF.NetCore" project.
Inside the project there is a "Svg" Folder which contains the "FontAwesomeSvg.all.json" file as embedded resource.
-> "{Namespace}.{Path inside Project with . instead of /}.{FileName}"
Hope this helps. I will try to make the README complete.
from fontawesome6.
Ok, i played a little bit around and the problem here is that the json file needs to be loaded, directory or embedded resource doesn't matter. I could get it working by adding the Svg.FontAwesomeSvg.LoadFromResource
inside the constructor of the ViewModel of a Window and set the ViewModel as DataContext inside the Window,xaml. But this is not really a good solution
from fontawesome6.
Hi, i found a way to load the icons, but it is very hacky :).
You can add a DesignTimeResourceDictionary and load a dedicated Loading UserControl which calls the load method.
I added a tutorial to the README and modified the Example Projects.
from fontawesome6.
I would say that the Readme could be updated with better instructions for how to do the runtime setup to get things working.
For example, to get FontAwesome6.Pro.Svg working in my WinUI 3 project, I have to:
- (follow the instructions on https://github.com/MartinTopfstedt/FontAwesome6#fontawesome6prosvg as written to install the nuget package and generate the json file)
- In csproj file, make sure json file is included as embedded resource (I include it as linked since it's shared between a couple of projects)
<EmbeddedResource Include="..\Shared\Assets\FontAwesomeSvg.json" Link="SharedAssets\FontAwesomeSvg.json"/>
. I included the "all.json" file from the generator, just renamed. - In startup App constructor, after configuring services, with
using FontAwesome6.Svg;
, runFontAwesomeSvg.LoadFromResource
with the appropriate resource string. To find the appropriate resource string I usedSystem.Reflection.Assembly.GetCallingAssembly().GetManifestResourceNames()
to see the name and thenFontAwesomeSvg.LoadFromResource("MyProjectName.SharedAssets.FontAwesomeSvg.json", System.Reflection.Assembly.GetCallingAssembly());
- In XAML, include
xmlns:fas="using:FontAwesome6.Svg"
(notxmlns:fas="http://schemas.fontawesome.com/icons/svg
, that doesn't work) and then use<fas:SvgAwesome Icon="Light_Eject" PrimaryColor="HotPink" Width="50"/>
for the icon as needed.
This seems to be sufficient to get FontAwesome6.Pro.Svg working in my WinUI 3 project.
from fontawesome6.
Related Issues (19)
- Merge to master? HOT 1
- SVG Icon not working with Version 2.0.0 HOT 6
- reduce TargetFramework to net6.0-windows10.0.18362.0 HOT 3
- FontAwesome6.Svg contains FontAwesome6.Fonts.WinUI.dll HOT 1
- [WinUI] The 'Icon' property that can be attached was not found in type 'SvgAwesome'. HOT 3
- [WinUI] FontAwesome is not beeing rendered HOT 13
- Strong naming HOT 2
- MAUI HOT 1
- Can't have multiple instances. HOT 1
- Couldnt find FontFamily for None exception HOT 1
- [WPF] Duotone icon glitch HOT 2
- WPF Icons do not display unless fonts are in temp/. Fonts being in temp/6.1.2/ does not work. HOT 4
- How to use this? HOT 4
- ...type 'fa:SvgAwesome' and ...type faf:FontAwesome" not found HOT 3
- How to stretch the icon?
- Building locally and/or nuget package?
- DevExpress XAML designer issue HOT 2
- Font doesn`t works HOT 8
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from fontawesome6.