私は、propertyGrid のようなコントロールを意図したものを達成するのに行き詰まっていますが、私の場合、特定のプロパティの前に値があり、後に値があります。たとえば、プロパティが name の場合、2 つの値が name before と name after となります。
class Person
{
#region class constructor
/// <summary>
/// class constructor
/// </summary>
/// <param name="_person"></param>
public Person(string before,string after)
{
this.nameBefore = before; // assign beforename to namebefore
this.nameAfter = after; // assign aftername to nameAfter
}
#endregion class constructor
#region properties
/// <summary>
/// Name property
/// </summary>
private string nameBefore;
/// <summary>
/// public Property
/// for nameBefore
/// </summary>
public string NameBefore
{
get { return nameBefore; }
set { nameBefore = value; }
}
/// <summary>
/// name property after
/// </summary>
private string nameAfter;
/// <summary>
/// public property for nameAfter
/// </summary>
public string NameAfter
{
get { return nameAfter; }
set { nameAfter = value; }
}
#endregion properties
}
このクラスのすべてのプロパティを公開する必要があります。これらのプロパティは、値の前後に値を持つ可能性があります。これらの値は外部で設定されます。プロパティ グリッドと同じように、これらの値を入力する必要があります。しかし、私の場合、もう1つの追加の列があります(後の値)。
それは私のxamlがどのように見えるかです:
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="20" />
<RowDefinition />
</Grid.RowDefinitions>
<TextBlock Background="Gray" Padding="5,2,5,5" Grid.Column="0" Grid.Row="0" Text="Property" />
<TextBlock Background="Gray" Padding="5,2,5,5" Grid.Column="1" Grid.Row="0" Text="Before" />
<TextBlock Background="Gray" Padding="5,2,5,5" Grid.Column="2" Grid.Row="0" Text="After" />
<TextBlock Grid.Column="0" Grid.Row="1" Text="Name" />
<TextBlock Grid.Column="1" Grid.Row="1" Text="{Binding Before }" />
<TextBlock Grid.Column="2" Grid.Row="1" Text="{Binding After }" />
</Grid>
私はこのようなものが必要です
プロパティ ウィンドウ
このようなものをプログラムで取得できますか? プロパティとその複数の値を持つことを意味します。multikeyvalue 辞書にすることもできますか?