简体   繁体   English

如何根据对象的值为GroupBox选择模板

[英]How do I select a template for a GroupBox based on the value of an object

I want the contents of a group box to be selected by value, so how I do write the XAML to do this? 我希望按值选择组框的内容,那么如何编写XAML来做到这一点?

<GroupBox Header="Specific details"
    ContentTemplateSelector={StaticResource someSelector}>

...

</GroupBox>

The template selector will let me select which template to use, but what I can't figure is the syntax to associate this group box with a value in a variable somehow? 模板选择器将允许我选择要使用的模板,但是我不知道是将这个组框与变量中的值相关联的语法吗?

答案是使用不带标题的TabControl,并通过值设置SelectedIndex。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何根据XAML中的运行时属性值动态选择上下文菜单模板? (自定义上下文菜单) - How do I select context menu template dynamically based on runtime property value in XAML? (context menu customization) 如何设置GroupBox标题颜色 - How do I set the GroupBox caption colour 我如何 select 中的 c# 中的组框并在我的应用程序中删除它? - how can i select a groupbox in c# and delete it inside my application? 如何将标签的字体颜色设置为与GroupBox的标题颜色相同? - How do I set the Font color of a label to the same as the caption color of a GroupBox? 如何在不使用GroupBox的情况下为单选按钮提供值并确定选定的单选按钮 - How can I give a radio button a value and determine the selected radio button without using a GroupBox 如何将 groupBox 的角改为锐角而不是圆形 C# .NET WPF - How do I change the corners of a groupBox to sharp instead of round C# .NET WPF 如何将FormattedText字符串转换为基于几何的对象? - How do I Convert a FormattedText String into a Geometry-Based Object? 如何从另一种方法生成的列表中 select 和 object ? - How do I select an object from a list generated by another method? 如何根据 Authorization header 值授权请求? - How do I authorize requests based on the Authorization header value? 如何根据子xml的值获取父xml - How do i get the parent xml based on value of child xml
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM