• Как вставить векторное изображение в WPF окно?

    Casper-SC
    @Casper-SC
    Программист (.NET)
    Изображение можно увеличить (кликни или открой в новой вкладке). XAML код отформатирован расширением XamlStyler.

    5f9489198d002927078688.png

    <Window
        x:Class="WpfVectorImage.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:icons="clr-namespace:WpfVectorImage.Icons"
        xmlns:local="clr-namespace:WpfVectorImage"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        Title="MainWindow"
        Width="800"
        Height="450"
        mc:Ignorable="d">
        <Grid>
            <icons:DumbbellIcon />
        </Grid>
    </Window>


    Нельзя сюда выложить иконку, которая на скриншоте, слишком много символов.
    DumbbellIcon.xaml (иконка)
    <UserControl
        x:Class="WpfVectorImage.Icons.DumbbellIcon"
        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:local="clr-namespace:WpfVectorImage.Icons"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        d:DesignHeight="450"
        d:DesignWidth="800"
        mc:Ignorable="d">
    
        <Viewbox Stretch="Uniform">
            <Canvas
                Name="Layer_1"
                Width="512"
                Height="512">
                <Canvas.RenderTransform>
                    <TranslateTransform X="0" Y="0" />
                </Canvas.RenderTransform>
                <Canvas.Resources />
                <Canvas Name="g79">
                    <Canvas Name="g73">
    
                    </Canvas>
                </Canvas>
            </Canvas>
        </Viewbox>
    </UserControl>
    Ответ написан
    Комментировать