Come rendere DataSourceCriteria dipendente da una proprietà in XAF?
-
10-12-2019 - |
Domanda
Io uso il framework ExpressApp per sviluppare un'applicazione Windows.Voglio filtrare un editor della proprietà View di ricerca a seconda di una proprietà Enum nella mia classe.
Questo è il mio codice:
Classe di categoria:
private TranType tranType;
public TranType TranType
{
get
{
return tranType;
}
set
{
SetPropertyValue("TranType", ref tranType, value);
}
}
private string categoryName;
public string CategoryName
{
get
{
return categoryName;
}
set
{
SetPropertyValue("CategoryName", ref categoryName, value);
}
}
private Category parentCategory;
public Category ParentCategory
{
get
{
return parentCategory;
}
set
{
SetPropertyValue("ParentCategory", ref parentCategory, value);
}
}
.
Tran Class:
private Category category;
[DataSourceCriteria("TranType == TranType")]
public Category Category
{
get
{
return category;
}
set
{
SetPropertyValue("Category", ref category, value);
}
}
private static TranType myTranType;
[ImmediatePostData]
public TranType MyTranType
{
get
{
return myTranType;
}
set
{
SetPropertyValue("MyTranType", ref myTranType, value);
}
}
.
Ogni Category
ha un TranType
e voglio quando l'utente sceglie ad esempio TranType=Expense
, le categorie filtrate nella ricerca basata sul loro gruppo TranType
.
Grazie per l'aiuto.
Soluzione
Se ciò che vuoi è filtrare le categorie disponibili in una ricerca in una vista di una classe trans, quindi mettilo in questo modo
private Category category;
[DataSourceCriteria("MyTranType")]
public Category Category
{
get
{
return category;
}
set
{
SetPropertyValue("Category", ref category, value);
}
}
private static TranType myTranType;
[ImmediatePostData]
public TranType MyTranType
{
get
{...
.
Dai un'occhiata a questo documento http://documentation.dexpress.com/#xaf/customdocument2681
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow