SVI
SVI

Reputation: 1651

Dataform in Silverlight 3

I am using Dataform to show a object in my Silverlight application. It is a simple Input page which where you can input value and the SAVE button at the bottom submits the information to the database.

My object contains 7 data fields, out of which I need to show only 5 of them. The other two data fields are added in the database directly.

My silverlight application communicates to the database via WCF services.

So, the question is can I filter data fields on the dataform?

Upvotes: 1

Views: 726

Answers (2)

SVI
SVI

Reputation: 1651

Following is the snippet from xaml file

dataFormToolkit:DataForm x:Name="dataForm" CommitButtonContent="Save" CancelButtonContent="Cancel" AutoEdit="True" AutoGenerateFields="False"

Following is the snippet from xaml.cs file

    public CreateProduct()
    {
        InitializeComponent();
        this.Loaded += new RoutedEventHandler(CreateProduct_Loaded);


    }

    private void CreateProduct_Loaded(object sender, RoutedEventArgs e)
    {

        ServiceReference.Product model = new ServiceReference.Product();
        dataForm.CurrentItem = model;
    }

Upvotes: 0

Neil
Neil

Reputation: 1922

If you are Auto-generating the DataForm, you can use

[Display(AutoGenerateField=false)]
public string SomeProperty {get;set;}

This attribute was previously called Bindable in the SL3 beta, and has since changed in the RTM release. More info here

Upvotes: 2

Related Questions