Welcome to the Xceed Community Sign in | Join | Help
Community Search  

Data Binding

Sort Posts: Previous Next
  •  05-10-2008, 1:01 PM Post no. 12147

    Data Binding

    What could be wrong in the following code?

     

    [CODE]

    <Page xmlns:my="clr-namespace:Xceed.Wpf.DataGrid;assembly=Xceed.Wpf.DataGrid"  x:Class="TimeSheetClient.TimeSheet"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="TimeSheet" xmlns:xcdg="http://schemas.xceed.com/wpf/xaml/datagrid">
        <Grid>
            <Grid.Resources>
                <xcdg:DataGridCollectionViewSource x:Key="cvs_usersgroups" Source="{Binding Source ={x:Static Application.Current}, Path=UsersGroups}" />
            </Grid.Resources>
            <my:DataGridControl Name="UsersGroupsGrid" AutoCreateDetailConfigurations="True" ItemsSource="{Binding Source={StaticResource cvs_usersgroups}}">
                <my:DataGridControl.View>
                    <xcdg:TableView UseDefaultHeadersFooters="False">
                        <xcdg:TableView.Headers>
                            <DataTemplate>
                                <xcdg:InsertionRow />
                            </DataTemplate>
                        </xcdg:TableView.Headers>
                        <xcdg:TableView.FixedHeaders>
                            <DataTemplate>
                                <xcdg:HierarchicalGroupByControl xcdg:TableView.CanScrollHorizontally="False" />
                            </DataTemplate>
                            <DataTemplate>
                                <xcdg:ColumnManagerRow />
                            </DataTemplate>
                        </xcdg:TableView.FixedHeaders>
                        <xcdg:TableView.Theme>
                            <xcdg:AeroNormalColorTheme />
                        </xcdg:TableView.Theme>
                    </xcdg:TableView>
                </my:DataGridControl.View>
            </my:DataGridControl>
        </Grid>
    </Page>
    [/CODE]

     and code behind:

    [CODE]

     using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Windows;
    using System.Windows.Controls;
    using System.Windows.Data;
    using System.Windows.Documents;
    using System.Windows.Input;
    using System.Windows.Media;
    using System.Windows.Media.Imaging;
    using System.Windows.Navigation;
    using System.Windows.Shapes;
    using TimeSheetClient.TimeSheetServiceReference;

    namespace TimeSheetClient
    {
        /// <summary>
        /// Interaction logic for TimeSheet.xaml
        /// </summary>
        public partial class TimeSheet : Page
        {
            private static TimeSheetDataSet.UsersGroupsDataTable usersGroups;

            public static TimeSheetDataSet.UsersGroupsDataTable UsersGroups
            {
                get { return TimeSheet.usersGroups; }
            }

            static TimeSheet()
            {
                TimeSheetServiceClientInstance serviceClientInstance = TimeSheetServiceClientInstance.Instance;
                usersGroups = serviceClientInstance.serviceClient.UsersGroups();
            }

            public TimeSheet()
            {
                InitializeComponent();
            }
        }
    }

    [/CODE]
     

    i dont get data in the grid not even the columns as well. i did something like the example in the documentation. 

  •  05-12-2008, 7:59 AM Post no. 12159 in reply to 12147

    Re: Data Binding

    Your binding is wrong in the DataGridCollectionViewSource:

    <xcdg:DataGridCollectionViewSource x:Key="cvs_usersgroups" Source="{Binding Source ={x:Static Application.Current}, Path=UsersGroups}" />

    Your UsersGroups property is not located in the Current Application page but rather TimeSheet. Your output window should be reporting this invalid binding.


    Technical Writer - Xceed Software

    Of all the things I've lost, I miss my mind the most. - Mark Twain
View as RSS news feed in XML
Contact | Site Map | Reviews | Legal Terms of Use | Trademarks | Privacy Statement Copyright 2008 Xceed Software Inc.