I have bound a collection from my database to a DevX GridControl
.
By default, it is shows all columns. How can I modify my Xaml code to strictly show the columns that I specify?
Here is the Xaml code:
<dxg:GridControl x:Name="lst1" AutoGenerateColumns="AddNew" ItemsSource="{Binding ListaImpianti}" ColumnsSource="{Binding c}"
EnableSmartColumnsGeneration="True" HorizontalAlignment="Left" Margin="93,131,0,0" VerticalAlignment="Top" Width="346"
FilterCriteria="{Binding FilterCriteria, ElementName=searchControl}" Height="479" >
<dxg:GridControl.Columns>
<dxg:GridColumn x:Name="CODICE" Binding="{Binding CODICE}" FieldName="CODICE"/>
<dxg:GridColumn x:Name="NOME" Binding="{Binding NOME}" FieldName="NOME"/>
</dxg:GridControl.Columns>
<dxg:GridControl.View>
<dxg:TableView AllowPerPixelScrolling="True" ShowTotalSummary="True" AllowEditing="False" ShowGroupPanel="False" />
</dxg:GridControl.View>
</dxg:GridControl>
ListaImpianti
is the query result from the ViewModel. It contains numerous fields and I would like to only show the fields NOME
and CODICE
.