Click here to Skip to main content
15,896,063 members
Home / Discussions / WPF
   

WPF

 
AnswerRe: Gradient background from image for XAML. Pin
AspDotNetDev7-Jan-10 13:53
protectorAspDotNetDev7-Jan-10 13:53 
GeneralRe: Gradient background from image for XAML. Pin
Member 23244837-Jan-10 14:10
Member 23244837-Jan-10 14:10 
AnswerRe: Gradient background from image for XAML. Pin
Pete O'Hanlon7-Jan-10 22:31
mvePete O'Hanlon7-Jan-10 22:31 
GeneralRe: Gradient background from image for XAML. Pin
Member 23244838-Jan-10 7:38
Member 23244838-Jan-10 7:38 
QuestionSystem.Exception in K2 Service Manager. Pin
jhonrsa7-Jan-10 9:11
jhonrsa7-Jan-10 9:11 
AnswerRe: System.Exception in K2 Service Manager. Pin
Pete O'Hanlon7-Jan-10 9:17
mvePete O'Hanlon7-Jan-10 9:17 
Question3D Rotation Pin
sajib_bd7-Jan-10 6:04
sajib_bd7-Jan-10 6:04 
QuestionBind to Single Element in Itemssource Using XAML Pin
C.J.7-Jan-10 5:42
C.J.7-Jan-10 5:42 
Alright, here's what I've got.   I have an IEnumerable collection of type <Person> containing some random info (name, age, etc).   I create a PagedCollectionView using my <Person> collection and bind it to a DataGrid.   Then I make a PropertyGroupDescription using the "Name" property of my <Person> object and voila, I've got a datagrid that is grouped by name.

////code for above///////////////
PagedCollectionView pagedCollectionView = new PagedCollectionView(Person.GetPeople(), true, false);
PersonDataGrid.ItemsSource = pagedCollectionView;
PropertyGroupDescription namePropertyGroupDescription = new PropertyGroupDescription("Name");
pagedCollectionView.GroupDescriptions.Add(namePropertyGroupDescription);
/////////////////////////////////

Now instead of just showing the name of the group and the number of items in the RowGroupHeader, I would like to show a DataGrid containing the 1st row of each group.   Using this code:

<Grid x:Name="LayoutRoot" Background="White" HorizontalAlignment="Center">
            <data:DataGrid x:Name="PersonDataGrid" AutoGenerateColumns="False">                 
                  <data:DataGrid.Columns>
                        <data:DataGridTextColumn Header="Name" Binding="{Binding Name}" />
                        <data:DataGridTextColumn Header="Age" Binding="{Binding Age}" />
                        <data:DataGridTextColumn Header="Height" Binding="{Binding Height}" />
                        <data:DataGridTextColumn Header="Weight" Binding="{Binding Weight}" />
                        <data:DataGridTextColumn Header="Phone Number" Binding="{Binding Phone}" />                       
                  </data:DataGrid.Columns>              
                 
                  <data:DataGrid.RowGroupHeaderStyles>
                        <Style x:Name="DataGridRowGroupHeaderStyle" TargetType="data:DataGridRowGroupHeader">
                              <Setter Property="SublevelIndent" Value="0" />
                              <Setter Property="Height" Value="80" />
                              <Setter Property="Template">
                                    <Setter.Value>
                                          <ControlTemplate>
                                                <data:DataGrid AutoGenerateColumns="False" HeadersVisibility="None" ItemsSource="{Binding Items}">
                                                      <data:DataGrid.Columns>
                                                            <data:DataGridTextColumn Header="Name" Binding="{Binding Name}" />
                                                            <data:DataGridTextColumn Header="Age" Binding="{Binding Age}" />
                                                            <data:DataGridTextColumn Header="Height" Binding="{Binding Height}" />
                                                            <data:DataGridTextColumn Header="Weight" Binding="{Binding Weight}" />
                                                            <data:DataGridTextColumn Header="Phone Number" Binding="{Binding Phone}" />
                                                      </data:DataGrid.Columns>
                                                </data:DataGrid>
                                          </ControlTemplate>
                                    </Setter.Value>
                              </Setter>
                        </Style>
                  </data:DataGrid.RowGroupHeaderStyles>
            </data:DataGrid>
      </Grid>

I've got all of the items in the group showing up in the grid contained in the RowGroupHeader.   Is there any way to just show the first row of each group in my RowGroupHeader?   I've tried using a converter:

public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
      List<Person> personList = (value as IEnumerable<Person>).ToList();
      return new List<Person> { personList[0] };
}

but I can't get it to work properly.   Any ideas?
AnswerRe: Bind to Single Element in Itemssource Using XAML Pin
Abhinav S7-Jan-10 5:59
Abhinav S7-Jan-10 5:59 
GeneralRe: Bind to Single Element in Itemssource Using XAML Pin
C.J.7-Jan-10 6:04
C.J.7-Jan-10 6:04 
GeneralRe: Bind to Single Element in Itemssource Using XAML Pin
Abhinav S7-Jan-10 6:16
Abhinav S7-Jan-10 6:16 
GeneralRe: Bind to Single Element in Itemssource Using XAML Pin
C.J.7-Jan-10 6:47
C.J.7-Jan-10 6:47 
QuestionWPF Datagrid Style Pin
reibor6-Jan-10 10:12
reibor6-Jan-10 10:12 
AnswerRe: WPF Datagrid Style Pin
Mark Salsbery6-Jan-10 12:37
Mark Salsbery6-Jan-10 12:37 
QuestionArgghh my controls are disabled and cannot figure out why!!! Pin
Michael Eber6-Jan-10 9:26
Michael Eber6-Jan-10 9:26 
AnswerRe: Argghh my controls are disabled and cannot figure out why!!! Pin
Ian Shlasko7-Jan-10 3:09
Ian Shlasko7-Jan-10 3:09 
GeneralRe: Argghh my controls are disabled and cannot figure out why!!! Pin
Michael Eber7-Jan-10 7:47
Michael Eber7-Jan-10 7:47 
GeneralRe: Argghh my controls are disabled and cannot figure out why!!! Pin
Ian Shlasko7-Jan-10 10:35
Ian Shlasko7-Jan-10 10:35 
Questionhow to navigate from 1 page to another Pin
hotthoughtguy6-Jan-10 8:18
hotthoughtguy6-Jan-10 8:18 
AnswerRe: how to navigate from 1 page to another Pin
Mark Salsbery6-Jan-10 8:47
Mark Salsbery6-Jan-10 8:47 
AnswerRe: how to navigate from 1 page to another Pin
April Fans6-Jan-10 19:10
April Fans6-Jan-10 19:10 
Questionsubclassing a treeviewitem Pin
hb521342146-Jan-10 4:21
hb521342146-Jan-10 4:21 
AnswerRe: subclassing a treeviewitem Pin
AspDotNetDev6-Jan-10 20:53
protectorAspDotNetDev6-Jan-10 20:53 
GeneralRe: subclassing a treeviewitem Pin
hb521342147-Jan-10 6:26
hb521342147-Jan-10 6:26 
QuestionRe: subclassing a treeviewitem Pin
AspDotNetDev7-Jan-10 13:44
protectorAspDotNetDev7-Jan-10 13:44 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.