Vector image as reusable XAML fragment

后端 未结 3 1046
野趣味
野趣味 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

    After some research, there is one more option: using a DrawingImage as Source for an image. The customary image source is a BitmapSource, however it can be "vector graphics" as well.

    Here is an example:

    
      
        
          
            
              
                
                  
                  
                
              
              
                
                  
                  
                
              
              
                
              
            
          
        
      
    
    

    produces such a nice vector image:

    vector image from the source above

    Yet another option might be using a DrawingBrush, like in this SO question: How to store and retrieve multiple shapes in XAML/WPF?.

提交回复
热议问题