Skip to content
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

AppName case style may determine whether show svg image or not #263

Open
Hellager opened this issue Sep 22, 2023 · 1 comment
Open

AppName case style may determine whether show svg image or not #263

Hellager opened this issue Sep 22, 2023 · 1 comment
Assignees

Comments

@Hellager
Copy link

I'm a front end developer and new to c#, prefer to use snake case in code.
So when i create a project which has a snake case namesapce, the svg image will not show unless it's camel case.

<!-- In Camel Case, Everything goes fine -->
<Window x:Class="WpfSvgTestBox.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:svgc="http://sharpvectors.codeplex.com/svgc/"
        xmlns:local="clr-namespace:WpfSvgTestBox"
        mc:Ignorable="d"
        Title="MainWindow" Height="450" Width="800">
    <Grid>
        <Button Visibility="Visible" Background="Transparent" ToolTip="Clean" BorderThickness="0" HorizontalAlignment="Right" VerticalAlignment="Bottom" Margin="0,0,7,10">
            <Button.Resources>
                <Style TargetType="Border">
                    <Setter Property="CornerRadius" Value="16"/>
                </Style>
            </Button.Resources>

            <StackPanel>
                <Image Source="{svgc:SvgImage Source=Assets/Icons/MySvgIcon.svg, AppName=WpfSvgTestBox}" Width="32" Height="32" />
            </StackPanel>
        </Button>
    </Grid>
</Window>

<!-- In Snake Case, the svg image will not show -->
<Window x:Class="wpf_svg_testbox.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:svgc="http://sharpvectors.codeplex.com/svgc/"
        xmlns:local="clr-namespace:wpf_svg_testbox"
        mc:Ignorable="d"
        Title="MainWindow" Height="450" Width="800">
    <Grid>
        <Button x:Name="ManualCleanButtonLight" Visibility="Visible" Background="Transparent" ToolTip="Clean" BorderThickness="0" HorizontalAlignment="Right" VerticalAlignment="Bottom" Margin="0,0,7,10">
            <Button.Resources>
                <Style TargetType="Border">
                    <Setter Property="CornerRadius" Value="16"/>
                </Style>
            </Button.Resources>

            <StackPanel>
                <Image Source="{svgc:SvgImage Source=Assets/Icons/MySvgIcon.svg, AppName=wpf_svg_testbox}" Width="32" Height="32" />
            </StackPanel>
        </Button>
    </Grid>
</Window>

Is this designed to be working like it ? Or we should be able to use snake case?

@paulushub
Copy link
Contributor

@Hellager The property AppName is the base name of the DLL or EXE containing the SVG file. WPF designer does not provide a interfaces at design-time, so AppName helps to identify the DLL/EXE containing the SVG.
I do not know if there is a special behavior of DLL/EXE name in snake case - will have to look into it.

@paulushub paulushub self-assigned this Sep 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants