Home Forums WPF controls Xceed DataGrid for WPF Simple example… still trying to bind to an XML document

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

    Here’s the XAML:

    <Window x:Class=”XTest.Window1″
    xmlns=”http://schemas.microsoft.com/winfx/2006/xaml/presentation&#8221;
    xmlns:x=”http://schemas.microsoft.com/winfx/2006/xaml&#8221;
    Title=”Window1″ Height=”599″ Width=”781″ xmlns:xcdg=”clr-namespace:Xceed.Wpf.DataGrid;assembly=Xceed.Wpf.DataGrid” xmlns:xcdg1=”http://schemas.xceed.com/wpf/xaml/datagrid”&gt;
    <Grid>
    <Grid.Resources>
    <XmlDataProvider x:Key=”xmlData”
    Source=”c:\program files\msts\serialized.xml”
    XPath=”/MSTSSchedule/m_Schedule”/>

    </Grid.Resources>
    <xcdg:DataGridControl Margin=”0,32,34,46″ Name=”dataGridControl1″ ItemsSource=”{Binding Source={StaticResource xmlData}}”>
    <xcdg:DataGridControl.View>
    <xcdg1:TableView>
    <xcdg1:TableView.Theme>
    <xcdg1:AeroNormalColorTheme />
    </xcdg1:TableView.Theme>
    </xcdg1:TableView>
    </xcdg:DataGridControl.View>
    <xcdg:DataGridControl.Columns>
    <xcdg:Column Title=”Summary”
    FieldName=”Summary”
    DisplayMemberBinding=”{Binding XPath=Summary}” MinWidth=”125″ />
    <xcdg:Column Title=”Starts”
    FieldName=”StartTime”
    DisplayMemberBinding=”{Binding XPath=StartTime}”/>
    <xcdg:Column Title=”Ends”
    FieldName=”EndTime”
    DisplayMemberBinding=”{Binding XPath=EndTime}”/>
    <xcdg:Column Title=”Description”
    FieldName=”Description”
    DisplayMemberBinding=”{Binding XPath=Description}”/>
    <xcdg:Column Title=”Location”
    FieldName=”Location”
    DisplayMemberBinding=”{Binding XPath=Location}”/>
    </xcdg:DataGridControl.Columns>
    </xcdg:DataGridControl>
    </Grid>
    </Window>

    Very simple.

    Now, here’s the .XML file:

    <?xml version=”1.0″ encoding=”utf-8″?>
    <MSTSSchedule xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance&#8221; xmlns:xsd=”http://www.w3.org/2001/XMLSchema”&gt;
    <m_Schedule>
    <MSTSAppointment>
    <Summary>Operations Manager stuff</Summary>
    <Location>Work in my office</Location>
    <Description>Open ERs, approve time, 1-on-1 meetings, cost center analysis.

    Goto: http://www.foxnews.com</Description&gt;
    <Priority>0</Priority>
    <Attendee>administrator</Attendee>
    <Private>false</Private>
    <Categories />
    <Created>2008-04-04T22:17:55.356</Created>
    <StartTime>2008-04-04T06:00:00</StartTime>
    <EndTime>2008-04-04T16:30:00</EndTime>
    <ID>0</ID>
    <Status>unknown</Status>
    <Information />
    </MSTSAppointment>
    <MSTSAppointment>
    <Summary>Another Outlook appointment</Summary>
    <Location>The location</Location>
    <Description>Some appointment from Outlook</Description>
    <Priority>0</Priority>
    <Attendee>administrator</Attendee>
    <Private>false</Private>
    <Created>2008-04-04T22:18:01.845</Created>
    <StartTime>2008-04-04T09:00:00</StartTime>
    <EndTime>2008-04-04T16:30:00</EndTime>
    <ID>0</ID>
    <Status>unknown</Status>
    <Information />
    </MSTSAppointment>
    <MSTSAppointment>
    <Summary>Test recurring appointment</Summary>
    <Location>Someplace</Location>
    <Description>Body goes here</Description>
    <Priority>0</Priority>
    <Attendee>administrator</Attendee>
    <Private>false</Private>
    <Created>2008-04-04T22:17:59.341</Created>
    <StartTime>2008-04-04T15:00:00</StartTime>
    <EndTime>2008-04-04T15:30:00</EndTime>
    <ID>0</ID>
    <Status>unknown</Status>
    <Information />
    </MSTSAppointment>
    <MSTSAppointment>
    <Summary>SDX Test Event</Summary>
    <Location>500012345</Location>
    <Description>The widget is broken</Description>
    <Priority>0</Priority>
    <Attendee>Administrator</Attendee>
    <Private>false</Private>
    <Created>2008-03-09T10:14:16</Created>
    <StartTime>2008-04-05T06:00:00</StartTime>
    <EndTime>2008-04-05T16:00:00</EndTime>
    <ID>384</ID>
    <Status>Waiting on Customer to Schedule</Status>
    <Information>We worked on this a while ago.</Information>
    </MSTSAppointment>
    </m_Schedule>
    </MSTSSchedule>

    Can someone please help me understand why I cannot get this to bind?????? The headers show up just find… just zero rows with data.

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

    User (Old forums)
    Member
    Post count: 23064

    You might want to check the FAQ about XML:

    http://forums.xceed.com/Forums/ShowPost.aspx?PostID=6869

    Specifically AutoCreateColumns=”False”

    Imported from legacy forums. Posted by John (had 3086 views)

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