0
我有一個樹控件,用戶可以通過檢查它們來選擇節點。我想給用戶一個選項,只顯示選定的項目。擴展器覆蓋Silverlight中的控件
我在想膨脹機。當用戶擴展擴展器時,擴展器在原始樹形控件上展開另一個僅顯示所選項目的內容。
麻煩的是膨脹機只能伸展到其內容的大小。我想讓擴展器充分伸展,以便在擴展器摺疊之前隱藏原始樹。
代碼如下。畫布外的樹是原始樹。畫布內的樹是擴展器應該顯示的只讀樹
<Grid Grid.Row="1" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
<Grid.RowDefinitions>
<RowDefinition Height="33" />
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Canvas Canvas.ZIndex="999" Grid.Row="0" HorizontalAlignment="Stretch" >
<telerik:RadExpander HorizontalAlignment="Right" ToolTipService.ToolTip="Show Selected Items"
ExpandDirection="Down" Expanded="RadExpander_Expanded" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch">
<telerik:RadExpander.Header>
<TextBlock
Text="Selected Items"
Width="{Binding RelativeSource={RelativeSource AncestorType=telerik:RadExpander}, Path=ActualWidth}" />
</telerik:RadExpander.Header>
<telerik:RadTreeView IsExpandOnSingleClickEnabled="True" IsLoadOnDemandEnabled="False"
Height="{Binding RelativeSource={RelativeSource AncestorType=telerik:RadExpander}, Path=ActualHeight}"
ItemTemplate="{StaticResource SelectedElementDataOnlyTemplate}" Margin="0,0,0,8"
ItemsSource="{Binding Path=SelectedElementsOnly}" x:Name="ElementsTree2" >
</telerik:RadTreeView>
</telerik:RadExpander>
</Canvas>
<telerik:RadTreeView AutomationProperties.AutomationId="ElementPicker" IsExpandOnSingleClickEnabled="True" IsVirtualizing="True"
ItemsOptionListType="None" Grid.Row="1" ItemTemplate="{StaticResource ElementDataTemplate}" IsRootLinesEnabled="True" Margin="0,0,0,8"
ItemsSource="{Binding Path=Elements}" IsLoadOnDemandEnabled="True" Visibility="{Binding ToggleSelectedElements,
Converter={StaticResource BoolToVisibilityConverter}}" LoadOnDemand="tvMain_LoadOnDemand" x:Name="ElementsTree" SelectedItem="{Binding Path=SelectedItem,Mode=TwoWay}">
</telerik:RadTreeView>
</Grid>
你可以進一步解釋一下嗎? – Jimmy 2013-02-25 17:52:15