Select to view content in your preferred language

Sorting table of content control

440
1
05-17-2012 09:45 AM
RobertBrodsky
Deactivated User
Hi;

I am trying to sort the table of content control

Here what I got so far:

<!--Table Of Content-->
        <userControls:WindowPanel x:Name="TOCPanel"
   IsOpen="{Binding ElementName=btnToggleTOC, Path=IsChecked, Mode=TwoWay}"
      HorizontalAlignment="Right" VerticalAlignment="Top" Width="191" Height="161"
   Margin="0,66,279,0">
            <ListBox x:Name="MyList" ItemsSource="{Binding ElementName=Map, Path=Layers}" Height="199" Width="177">
                <ListBox.ItemTemplate>
                    <DataTemplate>
                        <StackPanel Orientation="Horizontal">
                            <!--Layer visibility check box-->
                            <CheckBox IsChecked="{Binding Visible, Mode=TwoWay}" />
                            <!--Opacity slider-->
                            <Slider Margin="-5,0,0,0" Minimum="0" Maximum="1" Width="30"
                                Value="{Binding Opacity, Mode=TwoWay}" Height="18" />
                            <!--Layer name-->
                            <TextBlock Text="{Binding ID, Mode=OneWay}" Margin="5,0,0,0" >
                            <!-- Tool tip on hover-->
                                <ToolTipService.ToolTip>
                                    <StackPanel MaxWidth="400">
                                        <TextBlock FontWeight="Bold" Text="{Binding CopyrightText}" TextWrapping="Wrap" />
                                        <TextBlock Text="{Binding Description}" TextWrapping="Wrap" />
                                    </StackPanel>
                                </ToolTipService.ToolTip>
                            </TextBlock>
                        </StackPanel>
                    </DataTemplate>
                </ListBox.ItemTemplate>
            </ListBox>

Any ideas?

Thnak you.
0 Kudos
1 Reply
DominiqueBroux
Esri Frequent Contributor
You can develop a value converter sorting the list of layers as you want.

Then you will have to add this converter to your ItemsSource binding.
0 Kudos