Tôi có XAML sau:tài sản WPF Bind để sở hữu một yếu tố khác theo tên của phần tử
<Grid KeyboardNavigation.TabNavigation="Local" SnapsToDevicePixels="True">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Border Background="Transparent" BorderThickness="0,0,0,2" BorderBrush="{StaticResource TabPanelBorderBrush}">
<DockPanel LastChildFill="True">
<Button x:Name="LeftButton" Content="3" DockPanel.Dock="Left" Style="{DynamicResource TabControlButton}"></Button>
<StackPanel Orientation="Horizontal" DockPanel.Dock="Right">
<Button x:Name="RightButton" Content="4" Style="{DynamicResource TabControlButton}"></Button>
<Button x:Name="TabItemsList" Content="L" FontFamily="Segoe UI" Style="{DynamicResource TabControlButton}"></Button>
<Button x:Name="AddTabItem" Content="+" FontFamily="Segoe UI" Style="{DynamicResource TabControlButton}"></Button>
</StackPanel>
<ScrollViewer x:Name="ScrollViewer" VerticalScrollBarVisibility="Disabled" HorizontalScrollBarVisibility="Hidden">
<TabPanel x:Name="HeaderPanel" IsItemsHost="True" Panel.ZIndex="1" KeyboardNavigation.TabIndex="1"/>
</ScrollViewer>
</DockPanel>
</Border>
<Border Grid.Row="1" Background="{StaticResource TabControlBackground}"/>
<ContentPresenter Grid.Row="1" Name="PART_SelectedContentHost" ContentSource="SelectedContent"/>
</Grid>
<ListBox x:Name="TabItemsListBox" Width="200" Height="200" HorizontalAlignment="Right" VerticalAlignment="Top" Visibility="Collapsed">
<ListBox.Margin>
<Thickness Left="0" Top="{Binding to TabItemsList height}" Right="0" Bottom="20"/>
</ListBox.Margin>
</ListBox>
</Grid>
Tôi muốn ràng buộc ListBox
s Height
's top Thickness
(TabItemsListBox) đến TabItemsList
'. Tôi có thể làm như thế nào? thử:
{Binding ElementName=TabItemsList, Path=Height}
nhưng chương trình của tôi nghiền nát khi tôi chạy nó
hãy thử ActualHeight thay vì Chiều cao – iulian3000
Vẫn nghiền ... – Ron
Đầu là loại Độ dày, đó là lý do tại sao nó nghiền nát, và bạn đang ràng buộc một đôi để thicknes. có thể với sự giúp đỡ của một công cụ chuyển đổi mà bạn gắn vào đầu trang – iulian3000