Vector image as reusable XAML fragment

后端 未结 3 1037
野趣味
野趣味 2020-12-30 10:48

I want to reuse some XAML fragment as image in some WPF application/library.

The background of the problem is following:

It\'s easy to reuse a bitmap image i

3条回答
  •  再見小時候
    2020-12-30 11:45

    You can add the x:Shared attribute to the Path Resource and use it as a StaticResource. This will work if "MyVectorImage" changes to something else

    Update
    Probably better to use a ContentControl or similar to be able to add Properties, such as Margin etc.

    
        
    
    
        
        
    
    

    Example. You replace "MyVectorImage" with a StackPanel containing two Paths.

    
        
            
            
        
    
    

提交回复
热议问题