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
Support of XamlHost / XamlIslands #205
Comments
Hi @evilbaschdi Can you provide a Demo App on github? That way we can have a look and maybe find a solution. Thank you in advance Happy coding |
Method "BrowseChildChanged" |
Hi @evilbaschdi // 1. We get the PathData as string which should be renderd
string pathData = new PackIconMaterial() { Kind = PackIconMaterialKind.CubeOutline }.Data;
// 2. We create the UWP Path which is needed to render
Geometry geometry = (Geometry)XamlBindingHelper.ConvertValue(typeof(Geometry), pathData);
// 3. Create the PathIcon and set the Foreground
System.Windows.Media.Color accentColor = (System.Windows.Media.Color)FindResource("MahApps.Colors.Accent");
PathIcon pathIcon = new PathIcon()
{
Data = geometry,
Foreground = new SolidColorBrush(Color.FromArgb(accentColor.A, accentColor.R, accentColor.G, accentColor.B))
};
// 4. Add it to your Panel
stackPanel.Children.Add(pathIcon); I hope this helps. Happy coding |
I’m closing this issue because it has been inactive for a long time. This probably means that it is not reproducible or it has been fixed in a newer version. If it’s an enhancement and hasn’t been taken on for so long, then it seems no one has the time to implement this. Please reopen if you still encounter this issue with the latest stable version and then please use the issue template. Thank you! 🙏 |
I played around with XamlHost a little bit.
The difference between "normal" WPF or UWP code ist that it's only possible to define the WindowsXamlHost it self and an "InitialTypeName" to be "Windows.UI.Xaml.Controls.Button" inside the xaml. All other stuff has to be done in the code behind - what is not so nice.
So I usually have had an icon next to my button caption as a content. So I added a StackPanel to the button and hostet an icon and a TextBlock inside the StackPanel.
Now with the current state of implementation of XamlIslands I have to do that all manually.
I already tried to host the PackIcon inside the Windows.UI.Xaml.Controls.StackPanel that ends up an some casting errors.
Lastly I added a new Image, set Binding.Source to my PackIcon and failed while setting the bindings converter to PackIconMaterialKindToImageConverter.
So do you have plans or already working code examples on how to host IconPacks inside Windows.UI.Xaml.Controls?
The text was updated successfully, but these errors were encountered: