[UWP][VB.NET] Problem with accordion control not adding new items? RRS feed

  • Question

  • I have a sync fusion accordion control which will refuse to update its layout to include a new item I added to my collection whether its an observable collection or not. I want to try and collapse the accordion and see if the items are added but cannot  figure out how to do so. I want to loop and collapse each item in the accordion programmatically. I need to do this to see if the items are added correctly. It gives me a weird error too if I add a button in my XAML like I do not have enough visual screen space but I do (even with enough space on desktop layout). Here's what my page looks like and the XAML for it (yes I am into the second flip view item):

    <Page xmlns:my="using:Syncfusion.UI.Xaml.Controls.Layout" 
            <CommandBar x:Name="Appbarbottom">
                    <AppBarButton x:Name="AddSource" Label="Add Evaluation Source" IsEnabled="True" />
                <AppBarButton x:Name="Cancel" Label="Cancel" Icon="Cancel" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Width="Auto" Visibility="Collapsed" />
                <AppBarButton x:Name="BtnAddItem" Label="Add Item" ToolTipService.ToolTip="Add Item to Evaluate" Icon="Add" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Width="Auto" />
                <AppBarButton x:Name="BtnSwitchToManual" ToolTipService.ToolTip="Switch to Manual" Label="Switch to Manual" Icon="Switch" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Width="Auto" />
                <AppBarButton x:Name="BtnReturnMain" ToolTipService.ToolTip="Return To Main Menu" Label="Finished" Icon="Back"  HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Width="Auto" />
        <Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
                <FlipView x:Name="EvaluateItemWizard" RelativePanel.AlignBottomWithPanel="True" RelativePanel.AlignRightWithPanel="True" RelativePanel.AlignLeftWithPanel="True" RelativePanel.AlignTopWithPanel="True"  HorizontalAlignment="Left" Margin="0,60,0,0" VerticalAlignment="Top" Width="1280" Height="615">
                    <FlipViewItem Height="615">
                            <TextBlock Text="Evaluation Using Specified Source" TextAlignment="Center"/>
                            <TextBlock Text="Evaluation Sources"/>
                            <ComboBox x:Name="cboSource" Width="187"/>
                            <TextBlock Text="Evaluation Sources"/>
                            <ListBox x:Name="lstSources"/>
                            <TextBlock Text="Items in Database"/>
                            <ComboBox x:Name="cboEvalItem" Width="187">
                                <ComboBoxItem x:Name="cboDefaultItem" Content="Default Item"/>
                            <TextBlock  Text="Item to Evaluate"/>
                            <TextBlock x:Name="TxtEvalItem"/>
                            <!--<Button Name="AddItem"></Button>
                            <Button Name="AddSource"></Button>-->
                            <TextBlock x:Name="ItemWarning" Text="Warning:  Item must be in database to Perform a Manual or Automatic Evaluation" Height="42" TextWrapping="Wrap"/>
                            <ProgressBar x:Name="EvaluationProgress"  HorizontalAlignment="Left" Height="20"  VerticalAlignment="Top" Width="201"/>
                            <!--<Button Name="btnnext1" Content="Next"></Button>-->
                    <FlipViewItem VerticalAlignment="Stretch" HorizontalAlignment="Stretch">
                        <StackPanel  ScrollViewer.VerticalScrollBarVisibility="Visible" ScrollViewer.VerticalScrollMode="Enabled"   HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
                            <TextBlock Text="Manual/Custom Evaluation" TextAlignment="Center"/>
                            <TextBlock Text="Evaluation Source (if necessary)"/>
                            <ComboBox x:Name="cboMSource" Width="187"/>
                            <TextBlock Text="Evaluation Source"/>
                            <ListBox x:Name="lstSources2"/>
                            <TextBlock Text="Items in Database"/>
                            <ComboBox x:Name="cboEvalItem2" Width="187">
                                <ComboBoxItem x:Name="cboDefaultItem2" Content="Default Item"/>
                            <TextBlock  Text="Current Item Selected"/>
                            <TextBlock x:Name="EvalItem2" />
                            <TextBlock Text="Current Item to Add"/>
                            <TextBox x:Name="TxtItem"/>
                            <Button x:Name="AddItem2" Content="Add Manual Item"></Button>
                            <my:SfAccordion RelativePanel.RightOf="EvaluateItemWizard"  x:Name="sfItems"   HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
                                        <TextBlock Text="{Binding name}"></TextBlock>
                                        <RelativePanel x:Name="relmainview"  HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
                                            <RelativePanel x:Name="relPrice" HorizontalAlignment="Left" VerticalAlignment="Stretch" Height="200">
                                                <TextBlock x:Name="lblEvalPrice" Text="Prices"/>
                                                <ListBox x:Name="lstPrices" RelativePanel.Below="lblEvalPrice"/>
                                                <TextBlock x:Name="lblprice" Text="Price to Add:" RelativePanel.Below="lstPrices"></TextBlock>
                                                <TextBox x:Name="TxtPrice" RelativePanel.Below="lstPrices" RelativePanel.RightOf="lblprice"></TextBox>
                                                <Button x:Name="BtnAddPrice" Content="Add Price" Click="BtnAddPrice_Click" RelativePanel.Below="lstPrices" RelativePanel.RightOf="TxtPrice"></Button>
                                            <RelativePanel x:Name="relCondition" RelativePanel.RightOf="relPrice" Width="200" Height="200">
                                                <!-- relative panel for adding the condition later /-->
                                                <!--<TextBlock Name="lblTest" Text="{Binding name}"></TextBlock>-->
                                                <TextBlock x:Name="lblEvalCondition" Text="Conditions of Item"/>
                                                <ListBox x:Name="lstCondition"/>
                                                <TextBlock x:Name="lblCondition" Text="Condition:" RelativePanel.Below="lstCondition"></TextBlock>
                                                <ComboBox x:Name="cboCondition" RelativePanel.Below="lstCondition" RelativePanel.RightOf="lblCondition"></ComboBox>
                                                <!--<Button x:Name="BtnAddCondition" Content="Add Price" Click="BtnAddCondition_Click"  RelativePanel.Below="lstCondition" RelativePanel.RightOf="cboConditon"></Button>-->
                                                <!--Loading="lstCondition_Loading"/> /-->
                                                <!-- move the loading event handler code from lstCondition to the combo box's loading event handler /-->
                            <!--<Button Name="AddItem"></Button>
                            <Button Name="AddSource"></Button>-->
                            <TextBlock x:Name="ItemWarning2" Text="Warning:  Item must be in database to Perform a Manual or Automatic Evaluation"/>
                            <!--<Button Name="btnnext1" Content="Next"></Button>-->
                <TextBlock x:Name="TxtEvalTitle" HorizontalAlignment="Left"  Height="45" TextWrapping="Wrap" Text="Item Evaluation Wizard" TextAlignment="Center" VerticalAlignment="Center" Width="432" Margin="0,0,-370,-25" FontSize="18"/>

    The main problem as you can see above is it only adds one item to the whole thing and does not populate the other controls in the template either (under relcondition relative panel in XAML above) despite the itemssource being more then one item. 

    Here's my code behind for AddItem2 which populates the control:

            sfItems.SelectionMode = AccordionSelectionMode.OneOrMore
            If TxtItem.Text <> "" Then
                Dim a As Byte = CByte(0)
                Dim b As New List(Of Byte)
                Dim tmpiteminfo As ItemInfo
                tmpiteminfo.aquisitiondate = DateTime.Now.ToString
                tmpiteminfo.name = TxtItem.Text
                tmpiteminfo.evaluationSource = ""
                tmpiteminfo.itemcondition = ItemCondition.LooksLikeNew
                tmpiteminfo.price = 30.0
                tmpiteminfo.damaged = "NO"
                tmpiteminfo.itempicture = b.ToArray
                tmpiteminfo.itemid = 1
                'If sfItems.ItemsSource IsNot Nothing Then
                '    Dim current As List(Of ItemInfo) = CType(sfItems.ItemsSource, List(Of ItemInfo))
                '    'tmpiteminfo.itemid = current.Count + 1
                '    'itemlist.Add(tmpiteminfo)
                '    current.Add(itemlist.Item(0))
                '    sfItems.ItemsSource = Nothing
                '    sfItems.ItemsSource = current
                'End If
                If sfItems.ItemsSource IsNot Nothing Then
                    sfItems.ItemsSource = Nothing
                    sfItems.ItemsSource = itemlist
                    ' sfItems.UpdateLayout()
                    sfItems.ItemsSource = itemlist
                End If
            End If
        End If

    Any help with the above problem of data not loading/binding correctly?

    Once you eliminate the impossible, whatever remains, no matter how improbable, must be the truth. - Sherlock Holmes. speak softly and carry a big stick - theodore roosevelt. Fear leads to anger, anger leads to hate, hate leads to suffering - Yoda. Blog - http://www.computerprofessions.us

    • Moved by Breeze Liu Friday, November 3, 2017 7:56 AM off topic
    Wednesday, November 1, 2017 10:37 PM

All replies

  • Hi The Thinker,

    Here is the official forum for developing UWP apps and your issue is more relative to the third party accordion control, we don't support it here. You can ask it in its official forum website. Thanks for your understanding.

    Best regards,


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    • Edited by Breeze Liu Friday, November 3, 2017 7:55 AM
    Friday, November 3, 2017 7:55 AM