2010-10-06 21 views
1

我想在Silverlight 4中創建一個數據表單。也許我做錯了什麼。Silverlight Dataform:「保存」和「編輯」按鈕不顯示

類:

public class ExpenseInfoTest 
{ 
    public int MyProperty { get; set; } 
    public int Foo { get; set; } 
    public int Bar { get; set; } 
} 

XAML:

<local:ExpenseInfoTest x:Key="newExpense"/> 

    <df:DataForm Height="218" 
       HorizontalAlignment="Left" 
       Margin="13,368,0,0" 
       Name="expenseDataForm" 
       VerticalAlignment="Top" 
       Width="590" 
       CurrentItem="{StaticResource newExpense}" /> 

什麼顯示: Just the fields without the save and edit buttons

我想 「保存」 按鈕。我怎樣才能讓它出現?我的XAML或數據類有問題嗎?

回答

2

在XAML中,在你的DataForm聲明添加

CommandButtonsVisibility="All" 

如果你願意,你可以綁定CommandButtonsVisibility至可以說,組合框

<ComboBox SelectedItem="{Binding CommandButtonsVisibility, ElementName=expenseDataForm, Mode=TwoWay}" SelectedIndex="0" > 

,並能夠控制基礎上,CB選擇哪一個命令按鈕可用。

1

這行代碼是有幫助的:

expenseDataForm.CommandButtonsVisibility = DataFormCommandButtonsVisibility.All; 
相關問題