views:

17

answers:

0

I hope to find an answer on customizing Datagrid from WPF toolkit 2010. I'd like to add a TITLE area to be above DataGridColumnHeaderPresenter of the datagrid. The problem is that I want it to be as a user control or data template where I can populate the title from XML. I want to have unique titles for multiple datagrids on one page getting data from one XML. I populate few datagrids in the same window. What will be the best solution to add customizable Tile area for a content populated from XML and bounded to each datagrid to avoid dublication?

Thank you in advance. I generate datagrid with columns this way:

<Custom:DataGrid Grid.Column="0" Grid.Row="1" x:Name="ServerList" ItemsSource="{Binding Source={StaticResource PagesData}, XPath=ListTiles/Tile1}">
<Custom:DataGrid.Columns>
    <Custom:DataGridTextColumn Header="Name" Binding="{Binding XPath=@Name}"  />
    <Custom:DataGridTextColumn Header="Status" Binding="{Binding XPath=@Status}"  />
    <Custom:DataGridTextColumn Header="Events" Binding="{Binding XPath=@Events}"  />
    <Custom:DataGridTextColumn Header="Services" Binding="{Binding XPath=@Services}" />
</Custom:DataGrid.Columns>

<Custom:DataGrid x:Name="Events" Grid.Column="0" Grid.Row="2" ItemsSource="{Binding Source={StaticResource PagesData}, XPath=ListTiles/Tile2}" >
<Custom:DataGrid.Columns>
    <Custom:DataGridTextColumn Header="Name" Binding="{Binding XPath=@Name}" />
    <Custom:DataGridTextColumn Header="Level" Binding="{Binding XPath=@Level}" />
    <Custom:DataGridTextColumn Header="Source" Binding="{Binding XPath=@Source}" />
    <Custom:DataGridTextColumn Header="In last 24h" Binding="{Binding XPath=@TimeSpan}" />
</Custom:DataGrid.Columns>

<Custom:DataGrid x:Name="Services" Grid.Column="2" Grid.Row="2" ItemsSource="{Binding Source={StaticResource PagesData}, XPath=ListTiles/Tile3}">
<Custom:DataGrid.Columns>
    <Custom:DataGridTextColumn Header="Name" Binding="{Binding XPath=@Name}" />
    <Custom:DataGridTextColumn Header="Status" Binding="{Binding XPath=@Status}" />
    <Custom:DataGridTextColumn Header="Start" Binding="{Binding XPath=@Start}" />
    </Custom:DataGrid.Columns>

XML:

<?xml version="1.0" encoding="utf-8"?>
<ListTiles  xmlns="">
<Tile1>
<Header Title="ROLES &amp; GROUPS" />
<Server Name="Kim" Status="ready" Events="1" Services="1" />
<Server Name="Sherri" Status="past" Events="2" Services="1"/>
<Server Name="Mike" Status="future" Events="3" Services="1" />
</Tile1> 
<Tile2>
<Header Title="EVENTS" />
<Server Name="Young"  Level="average" Source="home" TimeSpan="5" />
<Server Name="Sarah"  Level="Critical" Source="work" TimeSpan="6" />
<Server Name="Susan"  Level="normal" Source="friend" TimeSpan="2" />
</Tile2>
<Tile3>
 <Header Title="SERVICES" />
 <Server Name="Josh" DisplayName="FF" Status="Running" Start="Auto" />
 <Server Name="Amy" DisplayName="DD" Status="Rest" Start="Auto" />
 <Server Name="Bill" DisplayName="AS" Status="Work" Start="Auto" />
</Tile3>
</ListTiles>