GridPresenter - Bind to RIA with attribute in metadata.cs

8 replies. Last post: October 20, 2011 8:03 AM by Yudi
Tags :
  • New Discussion
  • New Question
  • New Product Feedback

Hi

I am using RIA services and entity framework as DAL. In the metadata class I defined the attributes such as display, required, etc. In my Silverlight application, I have until now used the DataGrid from the System.Windows.Controls.Data.DataForm.Toolkit. There I can bind a DataGrid column directly to a property (<sdk:DataGridTextColumn Binding="{Binding Name}" />). As a result, the Attributte are included automatically, e.g. Caption (Header).

            <sdk:DataGrid ItemsSource="{Binding MeasuringSystems}" SelectedItem="{Binding SelectedMeasuringSystem, Mode=TwoWay}" 
                          Intersoft:DockPanel.IsFillElement="True" Margin="5" IsReadOnly="true" AutoGenerateColumns="False" Background="Transparent">
                <sdk:DataGrid.Columns>
                    <sdk:DataGridTextColumn Binding="{Binding Name}" />
                    <sdk:DataGridTextColumn Binding="{Binding TesterTemplate.Name}" />
                    <sdk:DataGridTemplateColumn Header="{Binding DataGridHeaderNames.HeadName[0]}">
                        <sdk:DataGridTemplateColumn.CellTemplate>
                            <DataTemplate>
                                <TextBlock Text="{Binding TesterTemplate.Name}" />
                            </DataTemplate>
                        </sdk:DataGridTemplateColumn.CellTemplate>
                        <sdk:DataGridTemplateColumn.CellEditingTemplate>
                            <DataTemplate>
                                <ComboBox ItemsSource="{Binding Source={StaticResource Locator},Path=MeasuringSystem.TesterTemplates}"
                                          SelectedItem="{Binding TesterTemplates, Mode=TwoWay}"/>
                            </DataTemplate>
                        </sdk:DataGridTemplateColumn.CellEditingTemplate>
                    </sdk:DataGridTemplateColumn>
                    <sdk:DataGridTextColumn Binding="{Binding SplitChar}" />
                    <sdk:DataGridCheckBoxColumn Binding="{Binding Hide}" />
                </sdk:DataGrid.Columns>
            </sdk:DataGrid>

This is very helpful, because I must define the attributes in the metadata class only. If this now not yet supported, I hope that this is included in the next version.

I find that your GridPresenter provides great filtering and grouping features!

Thanks Michael

All times are GMT -5. The time now is 12:46 AM.
Previous Next