You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
88 lines
4.4 KiB
88 lines
4.4 KiB
<!--*************************************************************************************
|
|
|
|
Toolkit for WPF
|
|
|
|
Copyright (C) 2007-2025 Xceed Software Inc.
|
|
|
|
This program is provided to you under the terms of the XCEED SOFTWARE, INC.
|
|
COMMUNITY LICENSE AGREEMENT (for non-commercial use) as published at
|
|
https://github.com/xceedsoftware/wpftoolkit/blob/master/license.md
|
|
|
|
For more features, controls, and fast professional support,
|
|
pick up the Plus Edition at https://xceed.com/xceed-toolkit-plus-for-wpf/
|
|
|
|
Stay informed: follow @datagrid on Twitter or Like http://facebook.com/datagrids
|
|
|
|
*************************************************************************************-->
|
|
<local:DemoView x:Class="Xceed.Wpf.Toolkit.LiveExplorer.Samples.PropertyGrid.Views.PropertyGridDefinitionKeyView"
|
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
|
xmlns:local="clr-namespace:Xceed.Wpf.Toolkit.LiveExplorer"
|
|
xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
|
|
xmlns:s="clr-namespace:System;assembly=mscorlib"
|
|
VerticalScrollBarVisibility="Disabled"
|
|
Title="Using DefinitionKeyAttribute">
|
|
<local:DemoView.Description>
|
|
<Paragraph FontSize="14" FontFamily="Segoe">
|
|
The DefinitionKey attribute can be assigned to properties of your selected object to define which EditorDefinition to
|
|
be applied to the property.
|
|
<LineBreak/>
|
|
<LineBreak/>
|
|
As an alternative to the Editor attribute, this allows you separate the UI-specific code from your
|
|
business model code.
|
|
<LineBreak/>
|
|
<LineBreak/>
|
|
It can also be used to specify an editor to use as the default for property types that do not resolve to a valid editor (e.g., Object).
|
|
<!--##INCLUDE_OPEN_SOURCE
|
|
<LineBreak />
|
|
<LineBreak />
|
|
<Run>This feature is only available in the "Plus" version.</Run>
|
|
<LineBreak />
|
|
<Hyperlink NavigateUri="https://xceed.com/xceed-toolkit-plus-for-wpf" RequestNavigate="Hyperlink_RequestNavigate">
|
|
Click here for more details about Xceed Toolkit Plus for WPF.
|
|
</Hyperlink>
|
|
##END-->
|
|
</Paragraph>
|
|
</local:DemoView.Description>
|
|
|
|
<Grid>
|
|
<Grid.RowDefinitions>
|
|
<RowDefinition Height="Auto" />
|
|
<RowDefinition Height="*" />
|
|
</Grid.RowDefinitions>
|
|
<StackPanel Grid.Row="0" Margin="20">
|
|
<TextBlock Text="Here the FirstName and LastName DefinitionKey attribute refer to the same 'nameType' EditorDefinition"
|
|
TextWrapping="Wrap"
|
|
Margin="0,0,0,10"/>
|
|
<TextBlock Text="The ReferenceNo property declares a DefinitionKey as 'int?' to display the content with an IntegerUpDown despite being of type 'object'"
|
|
TextWrapping="Wrap"
|
|
Margin="0,0,0,10"/>
|
|
<!--##EXCLUDE_OPEN_SOURCE-->
|
|
<TextBlock Text="(Click XAML and Code tabs to see details)"
|
|
FontStyle="Italic"
|
|
Margin="0,10,0,0"/>
|
|
<!--##END-->
|
|
</StackPanel>
|
|
<!--##INCLUDE_OPEN_SOURCE
|
|
<ScrollViewer Grid.Row="1"
|
|
VerticalScrollBarVisibility="Auto"
|
|
HorizontalScrollBarVisibility="Auto">
|
|
<StackPanel>
|
|
<TextBlock Text="C# :" Margin="0,10,0,0" />
|
|
<local:CSharpBox CodeSource="/Samples/PropertyGrid/OpenSourceImages/DefinitionKey.cs.txt" />
|
|
<TextBlock Text="Xaml :" Margin="0,10,0,0" />
|
|
<local:XamlBox CodeSource="/Samples/PropertyGrid/OpenSourceImages/DefinitionKey.xaml.txt" />
|
|
</StackPanel>
|
|
</ScrollViewer>
|
|
##END-->
|
|
<!--##EXCLUDE_OPEN_SOURCE-->
|
|
<xctk:PropertyGrid x:Name="_propertyGrid" Grid.Row="1" HorizontalAlignment="Stretch" Width="350" MaxHeight="200"
|
|
SelectedObject="{Binding}">
|
|
<xctk:PropertyGrid.EditorDefinitions>
|
|
<!-- This EditorDefinition will be used for FirstName and LastName -->
|
|
<xctk:EditorTextDefinition TargetProperties="nameType" FontStyle="Italic" FontWeight="Bold" />
|
|
</xctk:PropertyGrid.EditorDefinitions>
|
|
</xctk:PropertyGrid>
|
|
<!--##END-->
|
|
</Grid>
|
|
</local:DemoView>
|
|
|