0
我已經將對象綁定到WPF控件。如何使用xaml單擊編輯按鈕來切換對象屬性「IsEditMode」,並在之後不使用代碼?這裏是XAML的示例代碼 -更改WPF中按鈕單擊的綁定對象屬性
<Label Style="{StaticResource TitleLabel}"
Content="{Binding Path=GroupTitle}"
Visibility="{Binding Path=IsEditMode, Converter={StaticResource boolToVis}}"
HorizontalAlignment="Left" />
<Button Content="Edit" HorizontalAlignment="Right" VerticalAlignment="Center">
<Button.Triggers>
<EventTrigger RoutedEvent="Button.Click">
<!--Toggle the bindedobject.IsEditMode property of click of button-->
</EventTrigger>
</Button.Triggers>
</Button>
我們可以隱藏按鈕單擊上的標籤嗎? – 2010-08-31 12:46:21
是的,您只需將標籤可見性綁定到VM的屬性,然後在EnterEditMode中更新該屬性 – 2010-08-31 15:33:52