Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
2045
HospitalFloorSample how to refresh element
posted

I add button to Hospital Floor sample and want to change fill color in one bed. On click event I have these code

var vm = (HospitalFloorPlanViewModel)DataContext;

IEnumerable<TestFloor.ViewModels.MapElementViewModel> mevm =  vm.MapElements;

HospitalFloorPlanViewModel hfvm = new HospitalFloorPlanViewModel();

hfvm.ChangeColor(mevm);

Here is ChangeColor function in HospitalFloorPlanViewModel class

public void ChangeColor(IEnumerable<MapElementViewModel> ele)
{
 var t = ele.FirstOrDefault(x => x.Name == "0");

 t.Fill = new SolidColorBrush(Colors.Red);
}

The problem is bed color not refreshing unless I Check/uncheck one of the filter checks (bed Status filter). I tried to use bedLayer.ImportAsync();, but it's not working for me. How can I refresh one map element?

Thanks
 

 

Parents
No Data
Reply
  • 3255
    Suggested Answer
    posted

    Hi arkgroup,

     

    Try to call bedLayer's DataBind method, afterChangeColor call, e.g.:

    var vm = (HospitalFloorPlanViewModel)DataContext;

    IEnumerable<TestFloor.ViewModels.MapElementViewModel> mevm =  vm.MapElements;

    HospitalFloorPlanViewModel hfvm = new HospitalFloorPlanViewModel();

    hfvm.ChangeColor(mevm);

    xamMap.Layers["bedLayer"].DataBind();

     

    Regards,

    Ivan Kotev

Children