Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
270
How to add an item programmatically
posted

Hello,

I try to add a item programmatically to the XamPropertyGrid. The Source is a ListItem witch will be generated dynamically. Each Item contains a Headernam, Value, Type of the value and a readonly flag. I want to display it like this:

Headername | Value
Headername |Value
...
...

How can I do this in the right way?

I added some lines with a little sample. The wanted output is
Name | Frank

Sourecode:

XAML:

<Window
        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:local="clr-namespace:WpfApplication6"
        xmlns:ig="http://schemas.infragistics.com/xaml" x:Class="WpfApplication6.MainWindow"
        mc:Ignorable="d"
        Title="MainWindow" Height="350" Width="525">
    <Grid>
        <ig:XamPropertyGrid x:Name="propgrid"/>
    </Grid>
</Window>

Codebehind:

public partial class MainWindow : Window { public MainWindow() { InitializeComponent(); TransferObject frank = new TransferObject() { HeaderName = "Name", Value = "Frank", Typ = typeof(string), Readonly = false }; this.propgrid.SelectedObject = frank; } } public class TransferObject { public string HeaderName { get; set; } public object Value { get; set; } public Type Typ { get; set; } public bool Readonly { get; set; } }

Parents Reply Children
No Data