Plan Interactive SVG with Xamarin Forms

Viewed 187

I have a interactive SVG file (Floor plan).I need to add click events for each path (room,floor, etc..)enter image description here I am using hybridwebview I am not sure that is the right idea for it. am facing a problem with sending data from class c# ( or from Floor.xaml.cs) to page .html ( i want to attribute id into svg room) or if there is a simple idea such how to iterate the file .svg ! if i can give the a x:name a iterate it in Floor.xaml.cs

 <?xml version="1.0" encoding="UTF-8"?>
 <ContentPage ..    x:Name="_plan" >

<svg x:Name="buildingPlan" 
                    <clipPath id="001">
                        <path transform="matrix(0,-1,-1,-0,2592,1728)" d="M... Z " />
                    </clipPath>

<g clip-path="url(#001)">
                        <path transform="matrix(0,-1,-1,-0,2592,1728)" d="M 698.8634... Z " fill="#ffffff" />
                        <path transform="matrix(0,-1,-1,-0,2592,1728)" stroke-width="1" stroke-linecap="butt" stroke-miterlimit="10" stroke-linejoin="miter" fill="none" stroke="#000000" d="M 6.. Z " />
                   </g>
                    <clipPath id="002">
                        <path transform="matrix(0,-1,-1,-0,2592,1728)" d="M 690.238 1684.95 L 710.438 1684.95 L 710.438 1706.02 L 690.238 1706.02 Z " />
                    </clipPath>
                    <g clip-path="url(#002)">
                        <path transform="matrix(0,-1,-1,-0,2592,1728)" d="M.... Z " fill="#ffffff" />
                        <path transform="matrix(0,-1,-1,-0,2592,1728)" stroke-width="1" stroke-linecap="butt" stroke-miterlimit="10" stroke-linejoin="miter" fill="none" stroke="#000000" d="M 700.3378 ... " />
                    </g>
 </svg>
</ContentPage>

Floor.xaml.cs :

  public partial class Floor: ContentPage{
    
public Floor(){
     InitializeComponent();
//if it is possible to iterate through the svg ?
//buildingPlan.

}
public List<string> GetLocalsId(){
// simple method return list of locals;
}
  }
0 Answers
Related