In a WPF project, I have a user control (Valve.xaml) that defines a Polygon shape.

```
<Grid>
   <Polygon Name="pValve" Points="0,50 0,20 50,50 50,20" Style="{StaticResource Valve_Open}"/>
</Grid>

```

I am displaying the Valve user control in a window xaml (FFG.xaml) file, like such:

```
<Window
   <!-- removed other namespaces for brevity -->
   xmlns:cl="clr-namespace:FFG.Controls;assembly=PID.Controls">
   <Grid>
      <cl:Valve x:Name="valve201A"></cl:Valve>
   </Grid>
</Window>

```

I am setting the DataContext of FFG.xaml to class FFG\_ViewModel.cs, and it contains an instance of the Valve\_Model class. Valve\_Model essentially represents the valve that is drawn on the window in FFG.xaml.

```
public class FFG_ViewModel : ViewModelBase {

   public Valve_Model Valve201A { get; set; }

   // There are other properties and methods, but I've removed them for brevity also

}

```

Here is the Valve\_Model class:

```
public class Valve_Model  INotifyPropertyChanged {

        public event PropertyChangedEventHandler PropertyChanged;

        private bool _isValveOpen { get; set; }
        public bool IsValveOpen {
            get {
                return _isValveOpen;
            }
            set {
                _isValveOpen = value;
                OnPropertyChanged("IsValveOpen");
            }
        }

        #region INotifyPropertyChanged
        protected virtual void OnPropertyChanged(string propertyName) {
            PropertyChangedEventHandler handler = this.PropertyChanged;
            if (handler != null) {
                var e = new PropertyChangedEventArgs(propertyName);
                handler(this, e);
            }
        }
        #endregion

    }

```

**QUESTION:**
What I want is for the Style property in the Valve.xaml to change when the IsValveOpen property changes.

So if the valve is open then it would be:

```
<Polygon Name="pValve" Points="0,50 0,20 50,50 50,20" Style="{StaticResource Valve_Open}"/>

```

and when the property is changed to false then I need the style of the polygon to be changed to:

```
<Polygon Name="pValve" Points="0,50 0,20 50,50 50,20" Style="{StaticResource Valve_Closed}"/>

```

How do I go about implementing this exactly?