Home Forums WPF controls Xceed DataGrid for WPF Is it possible to achieve AutoCreateDetailConfigurations using 3.2 version

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • hemant.navarkar
    Participant
    Post count: 1
    #44947 |

    Hi…

    Using 3.2.0.0 (Community version)

    1 : I am using 3.2.0.0 version of Xceed.Wpf.DataGrid.
    2 : I have below code for showing items.
    3 : I want to maintain inner hierarchy of data model while displaying. Is It possible to achieve this using
    community version of the dll.

    Using 6.2.0.0 Version of dll

    Using latest version i can see this the results by adding two properties to grid control listed below.
    AutoCreateDetailConfigurations=”True”
    AllowDetailToggle=”True”

    Is there any property available that i can use as alternative for AutoCreateDetailConfigurations=”True”
    AllowDetailToggle=”True” 3.2.0.0 community version of the dll ?

    Here is the code that i am using.

    XCeedWindow.xaml

    <Window x:Class=”TestExceedDataGrid.XCeedWindow”
    xmlns=”http://schemas.microsoft.com/winfx/2006/xaml/presentation&#8221;
    xmlns:x=”http://schemas.microsoft.com/winfx/2006/xaml&#8221;
    xmlns:d=”http://schemas.microsoft.com/expression/blend/2008&#8243;
    xmlns:xcdg=”http://schemas.xceed.com/wpf/xaml/datagrid&#8221;
    xmlns:mc=”http://schemas.openxmlformats.org/markup-compatibility/2006&#8243;
    xmlns:local=”clr-namespace:TestExceedDataGrid”
    mc:Ignorable=”d”
    Title=”Window1″ Height=”300″ Width=”300″>

    <Window.Resources>
    <DataTemplate x:Key=”TeacherDataTemplate”>
    <StackPanel Orientation=”Horizontal”
    VerticalAlignment=”Center”
    Margin=”5,0,0,0″>
    <!–The flagPathConverter resource changes the value of a
    group (e.g., “Canada”) to an image. –>
    <TextBlock Text=”{Binding Tname}”
    TextTrimming=”WordEllipsis”
    VerticalAlignment=”Center” />

    <TextBlock Text=”{Binding Tage}”
    TextTrimming=”WordEllipsis”
    VerticalAlignment=”Center” />
    </StackPanel>
    </DataTemplate>
    </Window.Resources>
    <Grid>
    <Grid.Resources>
    <xcdg:DataGridCollectionViewSource x:Key=”schoolData” Source=”{Binding}”>
    <xcdg:DataGridCollectionViewSource.GroupDescriptions>
    <PropertyGroupDescription PropertyName =”SchoolName”/>
    </xcdg:DataGridCollectionViewSource.GroupDescriptions>
    </xcdg:DataGridCollectionViewSource>
    </Grid.Resources>

    <xcdg:DataGridControl x:Name=”mygrid” ItemsSource=”{Binding Source={StaticResource schoolData}}”
    AllowDetailToggle=”True”>
    <xcdg:DataGridControl.View>
    <xcdg:TableflowView FixedColumnCount=”1″>
    </xcdg:TableflowView>
    </xcdg:DataGridControl.View>

    <xcdg:DataGridControl.Columns>
    <xcdg:Column FieldName=”SchoolName” Title=”School” IsMainColumn=”True” Width=”100″/>

    <xcdg:Column FieldName=”Teachercount” Title=”TeacherCount” Width=”100″/>

    <xcdg:Column FieldName=”Studentcount” Title=”StudentCount” Width=”100″/>

    <xcdg:Column FieldName=”Teacher” Title=”TeacherData” Width=”100″ Visible=”True”
    CellContentTemplate=”{StaticResource TeacherDataTemplate}”
    GroupValueTemplate=”{StaticResource TeacherDataTemplate}” AllowGroup=”True”/>

    <!–<xcdg:Column FieldName=”Teacher.Tname” Title=”Teacher Name” Width=”100″ Visible=”True”/>
    <xcdg:Column FieldName=”Teacher.Tage” Title=”Teacher Age” Width=”100″ Visible=”True”/>–>
    </xcdg:DataGridControl.Columns>
    </xcdg:DataGridControl>
    </Grid>
    </Window>

    XCeedWindow.xaml.cs
    using System;
    using System.Collections.Generic;
    using System.Collections.ObjectModel;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    using System.Windows;
    using System.Windows.Controls;
    using System.Windows.Data;
    using System.Windows.Documents;
    using System.Windows.Input;
    using System.Windows.Media;
    using System.Windows.Media.Imaging;
    using System.Windows.Shapes;

    namespace TestExceedDataGrid
    {
    /// <summary>
    /// Interaction logic for Window1.xaml
    /// </summary>
    public partial class XCeedWindow : Window
    {
    public XCeedWindow()
    {
    this.DataContext = SchoolDataModel.GetDummySchoolData();
    InitializeComponent();
    }

    public class Teacher
    {
    private string tname;
    private string tage;

    public string Tname
    {
    get
    {
    return tname;
    }

    set
    {
    tname = value;
    }
    }

    public string Tage
    {
    get
    {
    return tage;
    }

    set
    {
    tage = value;
    }
    }

    public Teacher(string name, string age)
    {
    Tname = name;
    Tage = age;
    }

    }

    public class School
    {

    private string schoolName;
    private string teachercount;
    private string studentcount;
    private ObservableCollection<Teacher> teacher = new ObservableCollection<Teacher>();
    // private Teacher teacher;

    public School(string name, string tcunt, string scount)
    {
    schoolName = name;
    teachercount = tcunt;
    studentcount = scount;
    //fillSingleTeachrtData();
    fillTeachrtData();
    }

    //private void fillSingleTeachrtData()
    //{
    // try
    // {
    // int j = 0;
    // this.teacher = new Views.Teacher(“Hemant” + j.ToString(), “22”);
    // }
    // catch (Exception e)
    // {
    // }
    //}

    private void fillTeachrtData()
    {
    try
    {
    for (int j = 100; j < 110; j++)
    teacher.Add(new Teacher(“Hemant” + j.ToString(), “22”));
    }
    catch (Exception e)
    {
    }
    }

    public string SchoolName
    {
    get
    {
    return schoolName;
    }

    set
    {
    schoolName = value;
    }
    }

    public string Teachercount
    {
    get
    {
    return teachercount;
    }

    set
    {
    teachercount = value;
    }
    }

    public string Studentcount
    {
    get
    {
    return studentcount;
    }

    set
    {
    studentcount = value;
    }
    }

    public ObservableCollection<Teacher> Teacher
    {
    get
    {
    return teacher;
    }

    set
    {
    teacher = value;
    }
    }

    //public Teacher Teacher
    //{
    // get
    // {
    // return teacher;
    // }

    // set
    // {
    // teacher = value;
    // }
    //}
    }

    public static class SchoolDataModel
    {
    private static ObservableCollection<School> schoolData = new ObservableCollection<School>();

    public static ObservableCollection<School> GetDummySchoolData()
    {
    for (int i = 0; i < 10; i++)
    {

    for (int j = 0; j < 10; j++)
    {
    schoolData.Add(new School(“Samity” + i.ToString(), j.ToString(), j.ToString()));
    }

    }
    return schoolData;
    }

    }
    }
    }

    Fawzi [Xceed]
    Member
    Post count: 722

    Hi,

    Unfortunately, master-details view is only available in the Pro-edition of the grid, not in the Toolkit one.

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.