سؤال

أحاول إنشاء نموذج بيانات في 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}" />

ما هو معروض:Just the fields without the save and edit buttons

أريد زر "حفظ". كيف يمكنني أن أظهر؟ هل هناك شيء خاطئ في XAML أو فئة البيانات؟

هل كانت مفيدة؟

المحلول

في XAML الخاص بك ، أضف

CommandButtonsVisibility="All" 

في الخاص بك DataForm إعلان.

إذا أردت ذلك ، يمكنك ربط CommandButtonsVisibility لنقول صندوق التحرير والسرد

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

وتمكن من التحكم في أزرار الأوامر المتاحة بناءً على اختيار CB.

نصائح أخرى

هذا السطر من الكود مفيد:

expenseDataForm.CommandButtonsVisibility = DataFormCommandButtonsVisibility.All;
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top