2012-11-17 2 views
0

그것은 잘 작동 :WPF에서 클래스의 xaml 코드를 트리거하는 방법은 무엇입니까?

<Button Width="100" Height="30" Content="Click Me!"> 
     <Button.ToolTip> 
      <Border Margin="-4,0,-4,-3" Padding="10" Background="Silver"> 
      <Border.BitmapEffect> 
       <OuterGlowBitmapEffect></OuterGlowBitmapEffect> 
      </Border.BitmapEffect> 
       <Label>Nice tooltip</Label> 
      </Border> 
      </Button.ToolTip> 
    </Button> 

그러나, 나는 조건이있는 경우 취소 할 수있는 코드를 싶습니다. 예 :

if(str=="aaa") 
    MessageBox.Show("All will be o'kay"); 
else 
    { 
     //I would like this code to revoke 
     /* <Border.BitmapEffect> 
       <OuterGlowBitmapEffect></OuterGlowBitmapEffect> 
      </Border.BitmapEffect> 
     */ 
    } 

어떻게 할 수 있습니까?

답변

1

알림을 발생시키는 속성을 만들면됩니다. INotifyPropertyChanged 인터페이스를 구현할 수 있습니다. 코드에서 속성의 값을 변경하고 xaml로 바인딩하십시오.

+0

확인. 나는 INotifyPropertyChanged Interface에 대해 읽을 것이다. – StepUp

관련 문제