RadPanelBar / RadDataGrid 相对宽度绑定到项目子项?
因此,您可以在提供的图像示例中看到我想要完成的任务。我一定没有使用正确的宽度装订吗?基本上我有一个 RadPanelBar,其中 RadDataGrid 嵌入在 RadPanelBarItem 中,加载时它会一直显示在可视区域之外。我需要它尊重单元格的宽度并调整 GridSplitter。因此,它应该只是拉伸其父级的可用宽度,并通过 GridSplitter 运动继续拉伸。有什么想法吗?正确的 MaxWidth 绑定格式是什么?
<telerik:RadPanelBarItem x:Name="QuickFind" Header="Quick Find" IsExpanded="True">
<StackPanel x:Name="Container" Orientation="Vertical">
<TextBox x:Name="QuickSearch"
cal:Message.Attach="[Event KeyUp]=[Action QuickSearchKeyUp($eventArgs, $this.Text)]" />
<telerik:RadGridView ShowGroupPanel="False" AutoGenerateColumns="False" AutoExpandGroups="True" ShowColumnHeaders="False" RowIndicatorVisibility="Collapsed" Width="{Binding ElementName=Container,Path=ActualWidth}" ScrollViewer.HorizontalScrollBarVisibility="Hidden" ScrollViewer.VerticalScrollBarVisibility="Hidden" CanUserResizeColumns="False" IsReadOnly="True" cal:Message.Attach="[Event SelectionChanged]=[Action QuickSearchItemSelect($this.SelectedItem)]" x:Name="ResultsGrid" ItemsSource="{Binding QuickFindService.Results}" >
<telerik:RadGridView.Columns>
<telerik:GridViewDataColumn Header="Results" UniqueName="Results" DataMemberBinding="{Binding DisplayName}" />
</telerik:RadGridView.Columns>>
</telerik:RadGridView>
</StackPanel>
So what I'm trying to accomplish you can see in the image example provided. I must not be using the correct width binding? Basically I have a RadPanelBar with a RadDataGrid embedded in a RadPanelBarItem that keeps showing out of the viewable area when loaded. I need it to respect the width of the cell and adjust for a GridSplitter. So it should just stretch the available width of its Parent and continue to to stretch with a GridSplitter Movement. Any ideas? What would the proper MaxWidth binding format?
<telerik:RadPanelBarItem x:Name="QuickFind" Header="Quick Find" IsExpanded="True">
<StackPanel x:Name="Container" Orientation="Vertical">
<TextBox x:Name="QuickSearch"
cal:Message.Attach="[Event KeyUp]=[Action QuickSearchKeyUp($eventArgs, $this.Text)]" />
<telerik:RadGridView ShowGroupPanel="False" AutoGenerateColumns="False" AutoExpandGroups="True" ShowColumnHeaders="False" RowIndicatorVisibility="Collapsed" Width="{Binding ElementName=Container,Path=ActualWidth}" ScrollViewer.HorizontalScrollBarVisibility="Hidden" ScrollViewer.VerticalScrollBarVisibility="Hidden" CanUserResizeColumns="False" IsReadOnly="True" cal:Message.Attach="[Event SelectionChanged]=[Action QuickSearchItemSelect($this.SelectedItem)]" x:Name="ResultsGrid" ItemsSource="{Binding QuickFindService.Results}" >
<telerik:RadGridView.Columns>
<telerik:GridViewDataColumn Header="Results" UniqueName="Results" DataMemberBinding="{Binding DisplayName}" />
</telerik:RadGridView.Columns>>
</telerik:RadGridView>
</StackPanel>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
好的,因为使用 GridSplitter 和 RadDataGrid,我找不到任何在使用网格分割器时会触发宽度值属性更改的内容。因此,放弃了 RadDataGrid,使用了 Item Control,并使用标准 Stretch 方法解决了这个问题。
换句话说,绑定到不会触发由 GridSplitter 等事件引起的 PropertyChanged 事件的 ActualWidth 不会为您提供绑定宽度属性的动态值。暂时解决了:)
Ok so since with using the GridSplitter and the RadDataGrid I couldn't find anything that would fire off a property change to width value when the grid splitter is used. So ditched the RadDataGrid for an Item Control and solved it with the standard Stretch method.
In other words binding to the ActualWidth of something that wont trigger a PropertyChanged event caused by something like a GridSplitter wont give you a dynamic value you bind a width property to. Solved...for now :)