1

Silverlight 4でデータフォームを作成しようとしています。おそらく、何か間違ったことをしています。

クラス:

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}" />

表示される内容: 保存ボタンと編集ボタンのないフィールドのみ

「保存」ボタンが欲しいのですが。どうすれば表示できますか?XAMLまたはデータクラスに問題がありますか?

4

2 に答える 2

2

xamlに、

CommandButtonsVisibility="All" 

あなたのDataForm宣言で。

CommandButtonsVisibility必要に応じて、コンボボックスなどをバインドできます。

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

CBの選択に基づいて、使用可能なコマンドボタンを制御できます。

于 2010-10-06T01:38:12.160 に答える
1

このコード行は役に立ちます:

expenseDataForm.CommandButtonsVisibility = DataFormCommandButtonsVisibility.All;
于 2010-10-06T01:32:29.423 に答える