vorrei creare una datagrid personalizzata, a cui applicare uno style. Per questo, ho creato un namespace in cui la mia datagrid eredita la struttura della DataGrid. Ho collegato il namespace alle pagine e inserito la DataGrid, ma quando compilo mi appare l'errore: "Type 'MyApp.MyNs.MyGrid' is not defined".
Questo è il codice
codice:Namespace MyNs Class MyGrid Inherits Grid End Class Class MyDataGrid Inherits DataGrid End Class End Namespace <Page... xmlns:myns="clr-namespace:MyApp.MyNs" ... > <myns:MyGrid x:Name="myGrid"> <myns:MyDataGrid x:Name="myDataGrid"> </myns:MyDataGrid> </myns:MyGrid>
Se tolgo l'attributo x:Name, l'errore sparisce, ma se uso l'attributo Name appare quest'altro messaggio:
"Because MyGrid is implemented in the same assembly, you must set the x:Name attribute rather than the Name attribute". Le altre proprietà di base (Width, Height,...) funzionano correttamente.
Come faccio ad assegnare un nome ai miei tag?

Rispondi quotando
