C#: How to switch one property on when another property turns off on the map editor in real time?

39 Views Asked by At

I am trying to make a C# code to turn on one property item, "property 2," when "property 1" is off on the property grid view in real time, respectively. In the graph, I put the word on or off in the second column, but it is a click button. The default is true (the blue-clicked box). The code I made only works when I save the changes and open the property grid view. But I would like to see the changes in real time. So if I click "property 1", "property 2" is automatically turned off, and vice versa.

I have searched several posts, but without samples, it is hard to understand them. Thank you.

property 1 on
property 2 off

=============================================================== I have a similar setting as in the attached figure. In the figure, if "Enabled" is a bool and clicked, I'd like to have "Selected" unclicked in real time automatically, and vice versa. enter image description here

1

There are 1 best solutions below

0
BQF On

I don't know understand your problems. But you can use following code in your class :

public bool State{get;set;}
public string Property1=>State?"on":"";
public string Property2=>State?"":"off";

When set State property , change Property1 and Property2.