Home Forums WPF controls Xceed DataGrid for WPF Binding Problems without using Application.Current

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • User (Old forums)
    Member
    Post count: 23064
    #24828 |

    I want to Bound my grid with a Dataset.

    UserControl x:Class=”GMS_APP.DaylyInfo”
    xmlns=”http://schemas.microsoft.com/winfx/2006/xaml/presentation”
    xmlns:xcdg=”http://schemas.xceed.com/wpf/xaml/datagrid”
    xmlns:x=”http://schemas.microsoft.com/winfx/2006/xaml”
    xmlns:my=”clr-namespace:System;assembly=mscorlib”
    Height=”364.276666666667″ Width=”756.976666666667″ Name=”DataGridCtr”>
    <Grid>
    <Grid.Resources>
    <xcdg:DataGridCollectionViewSource x:Key=”DatagridData” Source=”{Binding Source={x:Static DataSetInfo},
    Path=DataInfo}”>
    </xcdg:DataGridCollectionViewSource>
    </Grid.Resources>

    <xcdg:DataGridControl Name=”DataGrid”
    NavigationBehavior=”RowOrCell”
    Margin=”0,0,1,0″
    ItemsSource=”{Binding Source={StaticResource DatagridData}}”>

    </xcdg:DataGridControl>
    </Grid>
    </UserControl>

    I have a class called DataSetInfo in the namespace GMS_APP.DaylyInfo

    public partial class DataSetInfo
    {
    static DataSetInfo()
    {

    }

    public DataTable DataInfo
    {
    get{ return m_DataInfo;}
    set{ m_DataInfo = value;}
    }

    private static DataTable m_DataInfo;

    the code generated i have this

    public DataGridView()
    {
    _DatasetInfo = new DataSetInfo();
    InitializeComponent();
    this.Loaded += new RoutedEventHandler(OnLoad);

    }

    But when i compile mi solution in VS2005 i have the following error message:

    ‘DataSetInfo’ member is not valid because it does not have a qualifying type name.

    I don ´t want to use application.current in xaml code because my solution is more complicate.
    Thanks for your help.

    Imported from legacy forums. Posted by daniel (had 600 views)

    User (Old forums)
    Member
    Post count: 23064

    I am not puting my dataclass in code behind ….. how can i declare my binding to an other class, without using application.current ?

    Imported from legacy forums. Posted by daniel (had 507 views)

    User (Old forums)
    Member
    Post count: 23064

    How can i reference the binding ( x:static application.current) i my data objet is in other class than the application class, i have a class called DataSetInfo but if i put in XAML (x:static datasetinfo) or i instantiate an objet _Datasetinfo an write (x:static _datasetinfo) i have a Xaml error :
    datasetinfo’ member is not valid because it does not have a qualifying type name.

    I really apreciate your help in this issue.

    Thanks

    Imported from legacy forums. Posted by daniel (had 335 views)

    Xceed Support
    Member
    Post count: 5658

    You can use the Singleton pattern to access your static data…

    http://en.wikipedia.org/wiki/Singleton_pattern

    You can then use {x:Static local:DatasetInfo.Instance} to access it.

    Imported from legacy forums. Posted by Marcus [Xceed] (had 833 views)

    User (Old forums)
    Member
    Post count: 23064

    Can i use in Csharp code

    Datagrid.DataContext = _DatasetInfo

    and after in Xaml use :

    <Grid.Resources>
    <xcdg:DataGridCollectionViewSource x:Key=”DatagridData” Source=”{Binding Path=DataInfo}”>
    </xcdg:DataGridCollectionViewSource>
    </Grid.Resources>

    Where DataInfo is my static accessing method to the table under my class DatasetInfo and _DatasetInfo is an instance of DatasetInfo .

    Thanks

    Imported from legacy forums. Posted by daniel (had 4948 views)

Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.