Should i use a trigger or Behaviors for this?

Posted by Michael on Stack Overflow See other posts from Stack Overflow or by Michael
Published on 2010-05-05T16:03:46Z Indexed on 2010/05/05 16:08 UTC
Read the original article Hit count: 362

I have an abstract object called Applicant and two different types of objects that inherit from Applicant called Business and Individual. So I have three classes that look like this:

public abstract class Applicant
{
...
}

public class Individual : Applicant
{
  ...
}

public class Business : Applicant
{
  ...
}

Now in the DataGrid I want to show all the details of Applicant object. When you choose a row I want to show details of either the business or individual as a internal grid. Something like this

<DataGrid>
     <DataGrid.Columns>
          <!--Show different columns -->
     </DataGrid.Columns>
     <DataGrid.RowDetailsTemplate>
         <!--Show if Individual -->
         <DataGrid>
              <DataGrid.Columns>
                <DataGridTextColumn Header="First Name" ... />
                <DataGridTextColumn Header="Last Name" ... />
              </DataGrid.Columns>
          </DataGrid>
          <!--Show if business -->
          <DataGrid>
              <DataGrid.Columns>
                <DataGridTextColumn Header="Business Name" ... />
                <DataGridTextColumn Header="Tax id" ... />
              </DataGrid.Columns>
          </DataGrid>
     </DataGrid.RowDetailsTemplate>
</DataGrid>

Now I'm not sure if I need to use a Triggers or Behaviors to accomplish this? Thanks for everyones help! FYI I'm using Silverlight 4.0 with Prism.

© Stack Overflow or respective owner

Related posts about silverlight-4.0

Related posts about silverlight-toolkit