locked
Getting a problem when using hub???

    Question

  • Show result up are "App.Model....". How to fix

    <Page.Resources>
         <CollectionViewSource x:Name="comboviewunit">     </CollectionViewSource>
        </Page.Resources>

    File cs.

     unit class:public object query_unit()
            {
                XDocument xml = XDocument.Load(@"Model/XMLEffort.xml");
                List<Folder> data = (from q in xml.Elements("effort").Elements("English")
                                   group q by q.Element("foder").Value into g
                                   select new Folder
                                   {
                                       title = (string)g.Key,                                 
                                   }).ToList();
                return data;
            }
    
    
    Mainpage.cs
    private void combunit_Loaded(object sender, RoutedEventArgs e)
            {
                comboviewunit.Source = unit.query_unit();
            }
    Into hub.
    <ComboBox x:Name="combunit" SelectionChanged="combunit_SelectionChanged" Loaded="combunit_Loaded" ItemsSource="{Binding Source={StaticResource comboviewunit}}" DisplayMemberPath="{Binding title}">
                                                                        
                                                                    </ComboBox>


    Friday, April 03, 2015 7:00 AM

Answers

  • Greg - there's not a question in this post.  Please provide much more information.

    Matt Small - Microsoft Escalation Engineer - Forum Moderator
    If my reply answers your question, please mark this post as answered.

    NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined objects and unknown namespaces.

    Friday, April 03, 2015 12:29 PM
    Moderator

All replies

  • Greg - there's not a question in this post.  Please provide much more information.

    Matt Small - Microsoft Escalation Engineer - Forum Moderator
    If my reply answers your question, please mark this post as answered.

    NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined objects and unknown namespaces.

    Friday, April 03, 2015 12:29 PM
    Moderator
  • Code combobox:

     <HubSection MinWidth="865" MaxWidth="865" Header="effort english">
                                            <DataTemplate>
                                                <Grid>
                                                    <Grid.RowDefinitions>
                                                        <RowDefinition Height="auto"></RowDefinition>
                                                        <RowDefinition Height="auto"></RowDefinition>
                                                        <RowDefinition Height="auto"></RowDefinition>
                                                    </Grid.RowDefinitions>
                                                    <Grid Grid.Row="0" Height="40">
                                                        <Grid>
                                                            <Grid.ColumnDefinitions>
                                                                <ColumnDefinition Width="auto"></ColumnDefinition>
                                                                <ColumnDefinition Width="auto"></ColumnDefinition>
                                                                <ColumnDefinition Width="auto"></ColumnDefinition>
                                                            </Grid.ColumnDefinitions>
                                                            <Grid Grid.Column="0">
                                                                <StackPanel Orientation="Horizontal">
                                                                    <TextBlock Text="Filter by unit :" Foreground="Black"></TextBlock>
                                                                    <ComboBox x:Name="combunit" SelectionChanged="combunit_SelectionChanged" Loaded="combunit_Loaded" ItemsSource="{Binding Source={StaticResource comboviewunit}}" DisplayMemberPath="{Binding title}">
                                                                        
                                                                    </ComboBox>
                                                                </StackPanel>
                                                            </Grid>
                                                        </Grid>

     <Page.Resources>
     </CollectionViewSource>
            <CollectionViewSource x:Name="comboviewunit"></CollectionViewSource>
        </Page.Resources>

    class MainFolder
        {
            List<Folder> folder;
            public object query_unit()
            {
                XDocument xml = XDocument.Load(@"Model/XMLEffort.xml");
                List<Folder> data = (from q in xml.Elements("effort").Elements("English")
                                   group q by q.Element("foder").Value into g
                                   select new Folder
                                   {
                                       title = (string)g.Key,                                 
                                   }).ToList();
                return data;
            }

    Friday, April 03, 2015 1:55 PM