Community
Showing results for 
Search instead for 
Do you mean 
Reply

WPF Bind to Contact

Copper Contributor
Posts: 42
Country: Germany

WPF Bind to Contact

Hi,

 

I am just testing out some WPF stuff with ACT. Actually I'd like to bind a ContactList to a DataGrid.

What's working so far is to bind to the "FullName"-Property of the Contacts in the List but I have no clue how to bind to the user-fields which are accessed via the FieldCollection of a Contact, e.g.

Act.Framework.Contacts.Contact c;
=Act.UI.ActApplication.Instance.ApplicationState.CurrentContact; System.Console.WriteLine((string)c.Fields["USER6",Act.Framework.MutableEntities.FieldNameType.Alias]);

My XAML which is working for the "FullName":

<Window>
    <Grid>
        <DataGrid x:Name="dg1">
            <DataGrid.Columns>
                <DataGridTextColumn Binding="{Binding FullName}"/>
                <!--Trying to bing to the USER6-Field, which is not working
                <DataGridTextColumn Binding="{Binding Fields["USER6",Act.Framework.MutableEntities.FieldNameType.Alias]}"/>
                -->
            </DataGrid.Columns>
        </DataGrid>
    </Grid>
</Window>

 I set the DataGrid's ItemsSource via:

Act.Framework.Lookups.ContactLookup cLookup=Act.UI.ActApplication.Instance.ActFramework.Lookups.LookupContactsReplace(@"SELECT TOP 1 CONTACTID FROM TBL_CONTACT",false,false);
Act.Framework.Contacts.ContactList cList=cLookup.GetContacts(null);
dg1.ItemsSource=cList;

So does anybody have some idea, how one could bind to these user-defined fields?

Could it just be some adjustment to the XAML-Syntax to wrap the parenthesis and the quotes?