WPF 选项卡控件样式
我的用户界面具有相当标准的外观和感觉。它的左侧有一列图标,单击时会在右侧打开一个不同的用户控件。目前,我对选择图标和用户控件包含使用单独的控件。我遇到了奇怪的焦点问题,我厌倦了尝试缓解这些问题,并且想知道是否可以将选项卡控件设计为看起来像我的 UI(假设选项卡控件在导航选项卡时不会出现焦点问题)。
这是基本 UI 的屏幕截图。样式主要是关于如何使选项卡控件页面选择看起来像我的图标列。有人想知道我如何使用选项卡控件来实现这一点吗?我的 xaml 此时非常弱。
替代文本 http://img413.imageshack.us/img413/8399/directoru.png< /a>
I've got a UI with a fairly standard look and feel. It has a column of icons on the left side which when clicked open a different user control on the right side. Currently I'm using separate controls for the selection icons and the usercontrol containment. I'm having strange focus issues that I am tired of trying to mitigate and am wondering if I could style a tabcontrol to look like my UI (under the assumption a tabcontrol would not have focus issues when navigating tabs).
Here is a screenshot of the basic UI. The styling is mostly about how to get the tabcontrols page selection to look like my column of icons. Anyone want to throw their hat in the ring as to how I might accomplish this with a tabcontrol? My xaml is pretty weak at this point.
alt text http://img413.imageshack.us/img413/8399/directoru.png
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
然后将图标放在 TabItems 的 Header 属性中,将 UserControls 放在 Content 属性中。这将使你达到目标的一半。如果您想要完全相同的外观,则需要通过复制当前模板(使用 Blend 或 ShowMeTheTemplate< /a> 复制当前模板)并根据需要进行修改。但只需更改这些属性即可让您测试 TabControl 是否消除了焦点问题。
编辑:这是一个示例模板,应该与您的屏幕截图非常接近
它基本上是普通 TabControl 的副本,添加和删除了一些边框。希望有帮助。
Then you put the icons in the Header property of the TabItems and the UserControls in the Content property. That will get you about halfway there. If you want the exact same look you'll need to retemplate the TabControl and TabItem by copying the current template (use Blend or ShowMeTheTemplate to copy the current template) and modifying it as needed. But just changing those properties will let you test whether a TabControl gets rid of your focus issues.
Edit: Here's an example template that should be pretty close to your screenshot
It's basically a copy of the normal TabControl with some Borders added and removed. Hope that helps.
如何使用
DockPanel
模板化TabControl
,并将TabPanel
的DockPanel.Dock
属性绑定到原始内容TabStripPlacement
属性如图所示?How about templating the
TabControl
with aDockPanel
, and binding theDockPanel.Dock
property of theTabPanel
to the originalTabStripPlacement
property as shown?