Home Forums WPF controls Xceed DataGrid for WPF Noob needs help with binding

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • User (Old forums)
    Post count: 23064
    #26592 |

    I’ve done this before in plain XAML but this is my first go with Xceed’s DataGrid.

    I’m trying to bind an XML data source to a DataGrid:

    <Window x:Class=”MyProject.Window1″
    Title=”Exocet” Height=”496″ Width=”700″ Background=”#FF3B3B3B” xmlns:my=”clr-namespace:Xceed.Wpf.DataGrid;assembly=Xceed.Wpf.DataGrid” xmlns:my1=”clr-namespace:Xceed.Wpf.DataGrid.Views;assembly=Xceed.Wpf.DataGrid”
    Loaded=”window_Loaded” Closing=”DataWindow_Closing” BorderThickness=”3″>

    <Grid xmlns:xcdg=”http://schemas.xceed.com/wpf/xaml/datagrid”&gt;
    <XmlDataProvider x:Key=”Data” Source=”c:\program files\msts\serialized.xml” XPath=”/MSTSSchedule/m_Schedule”/>
    <xcdg:DataGridCollectionViewSource x:Key=”c:\program files\msts\serialized.xml” Source=”{Binding Source={StaticResource Data}}”>
    <local:XmlDataGridItemProperty Name=”Summary” DataType=”{x:Type s:String}” Title=”Summary” />

    <xcdg:DataGridControl Margin=”12,48,12,46″ x:Name=”XmlGrid”
    ItemsSource=”{Binding Source={StaticResource Data}}”>
    <my1:AeroNormalColorTheme />


    I have added XmlPropertyDescriptor and XmlDataGridItemProperty classes to my project.

    Here’s the errors I get in the Designer (VS2008 btw):

    1) Type ‘String’ was not found

    2) ‘s’ is an undeclared namespace

    What am I doing wrong here… I have to admit XAML binding is a very confusing topic to me.

    Imported from legacy forums. Posted by yahgrid27 (had 2134 views)

    User (Old forums)
    Post count: 23064

    Don’t worry, you’ve made a very simple mistake 🙂

    You say: s:String, which basically means: find type String in namespace ‘s’. All of those namespaces are defined at the top of the code:

    xmlns:<b>my</b>=”clr-namespace:Xceed.Wpf.DataGrid;assembly=Xceed.Wpf.DataGrid” xmlns:<b>my1</b>=”clr-namespace:Xceed.Wpf.DataGrid.Views;assembly=Xceed.Wpf.DataGrid”

    So all you need to do is add this namespace, and you’re ready to go!


    Imported from legacy forums. Posted by Frances (had 3101 views)

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