首页 > 代码库 > Telerik RadPropertyGrid
Telerik RadPropertyGrid
Telerik RadPropertyGrid 的排序按钮、搜索框和描述面板的显隐只要设置SortAndGroupButtons、SearchBox、DescriptionPanel的属性值改为Visibility.Collapsed就可以了。
RadPropertyGrid中的属性值设置成combox来选择,效果如下图:
界面代码
<UserControl x:Class="SilverlightCreate.TelerikGrid" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation" mc:Ignorable="d" d:DesignHeight="300" d:DesignWidth="400"> <Grid x:Name="LayoutRoot" Background="White"> <telerik:RadPropertyGrid x:Name="grid1" Margin="155,0,0,0" AutoGeneratingPropertyDefinition="grid1_AutoGeneratingPropertyDefinition" LabelColumnWidth="100"> </telerik:RadPropertyGrid> </Grid></UserControl>
后台代码
public partial class TelerikGrid : UserControl { public TelerikGrid() { InitializeComponent(); grid1.SortAndGroupButtonsVisibility = Visibility.Collapsed; grid1.SearchBoxVisibility = Visibility.Collapsed; grid1.DescriptionPanelVisibility = Visibility.Collapsed; this.grid1.Item = new Employee() { FirstName = "Sarah", LastName = "Blake", Occupation = "Supplied Manager", StartingDate = DateTime.Today, IsMarried = true, sex = Sexs.男 }; } private void grid1_AutoGeneratingPropertyDefinition(object sender, Telerik.Windows.Controls.Data.PropertyGrid.AutoGeneratingPropertyDefinitionEventArgs e) { e.PropertyDefinition.GroupName = "Properties"; } } public class Employee { public string FirstName { get; set; } public string LastName { get; set; } public string Occupation { get; set; } public DateTime StartingDate { get; set; } public bool IsMarried { get; set; } public Sexs sex { get; set; } } public enum Sexs { 男, 女 }
Telerik RadPropertyGrid
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。