How to use?


<navigation:Page 
  x:Class="DemoDataGridToolBar.Views.RIA_indir_edit" 
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
  xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
  xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"

  xmlns:riac="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.DomainServices"
  xmlns:domain="clr-namespace:AdventureWorksService.Web;assembly=AdventureWorksService"
  xmlns:data="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data"						 
  xmlns:mac="clr-namespace:System.Windows.Controls;assembly=Slma.Windows.Controls.RIA"
  xmlns:ma="clr-namespace:System.Windows.Controls;assembly=Slma.Windows.Controls"
								 
  mc:Ignorable="d"
  xmlns:navigation="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Navigation"
  d:DesignWidth="800" d:DesignHeight="480"
  Title="RIA_indir_edit Page">
  <Grid x:Name="LayoutRoot">
    <!-- DomainDataSource -->
    <riac:DomainDataSource x:Name="dsProducts" AutoLoad="True" QueryName="GetVwProduct" LoadSize="30" >
      <riac:DomainDataSource.DomainContext>
        <domain:AdventureWorksDomainContext />
      </riac:DomainDataSource.DomainContext>
      <!-- !!!!!! Set a SortDescriptor. It is necessary for right running of DataPager --> 
      <riac:DomainDataSource.SortDescriptors>
        <riac:SortDescriptor PropertyPath="Name" Direction="Ascending" />
      </riac:DomainDataSource.SortDescriptors>
    </riac:DomainDataSource>

    <StackPanel Orientation="Vertical" Margin="0,20,0,0" Width="350">
      <!--*************************************************************************************************-->
      <!--  DataGridToolBar 
      ** You have to set a Binding to a DataGrid and a DomainDataSource
      ********************************** -->
      <mac:DataGridToolBarRIA  Height="45" Margin="0,0,0,2" 
          DataGrid="{ Binding ElementName=dgProducts, Mode=OneTime}"	
          DomainDataSource="{ Binding ElementName=dsProducts, Mode=OneTime}" >

        <!--   Here you can either set the columns you can use for filtering  
        or set property AutoGenerateFilter="True" in the DataGridToolBarRIA to setup all columns for filtering.
        -->
        <mac:DataGridToolBarRIA.ColumnsForFiltering>
          <ma:DataGridToolBarFilterItem ColumnName="Name"  />
          <ma:DataGridToolBarFilterItem ColumnName="Color"  />
          <ma:DataGridToolBarFilterItem ColumnName="Size"  />
        </mac:DataGridToolBarRIA.ColumnsForFiltering>
        <!--Here you can put own controls inside the DataGridToolBar control. 
        For example: DataPager
        -->
        <mac:DataGridToolBarRIA.Content>
          <data:DataPager x:Name="dpTest" PageSize="10" Source="{Binding ElementName=dsProducts, Path=Data}" BorderThickness="0" Background="Transparent" >
          </data:DataPager>
        </mac:DataGridToolBarRIA.Content>
      </mac:DataGridToolBarRIA>
      <!--*************************************************************************************************-->

      <ma:maDataGrid x:Name="dgProducts" Height="300" AutoGenerateColumns="False" 	  
	IsReadOnly="True"							
	ItemsSource="{Binding ElementName=dsProducts, Path=Data}">
        <data:DataGrid.Columns>
          <data:DataGridTextColumn Header="Product name" Binding="{Binding Name}" />
          <data:DataGridTextColumn Header="Color" Binding="{Binding Color}" />
          <data:DataGridTextColumn Header="Size"  Binding="{Binding Size}"  />
        </data:DataGrid.Columns>
      </ma:maDataGrid>
    </StackPanel>
  </Grid>
</navigation:Page>

Last edited Aug 31, 2010 at 5:14 PM by MirekM, version 5

Comments

No comments yet.