logo
down
shadow

Can I bind a multidimensional list to a DevExpress dataGrid?: List<List<object>>


Can I bind a multidimensional list to a DevExpress dataGrid?: List<List<object>>

By : Muhammad Raees
Date : November 22 2020, 11:17 AM
fixed the issue. Will look into that further DevEx Grid support Master-Detail rows. This link has more details. Might help.
code :


Share : facebook icon twitter icon
Add a complex object List with List of string to make a new list and bind to the Gridview

Add a complex object List with List of string to make a new list and bind to the Gridview


By : Rizal M.
Date : March 29 2020, 07:55 AM
I wish did fix the issue. Since there doesn't seem to be any relation between the two lists to join on, use an indexer:
code :
var result = queue.Select((x, i) => new
             {
                 x.QueueDetail,
                 x.Value,
                 ServerName = servernames[i]
             }).ToList();
...
ServerName = i < servernames.Count ? servernames[i] : ""
...
var result = queue.Select((x, i) => new
        {
            x.QueueDetail,
            x.Value,
            ServerName = (i == 0 ? string.Join(",", servernames) : "")
        }).ToList();
Is it possible to bind a List<Object> which contains List<String> to DataGrid

Is it possible to bind a List<Object> which contains List<String> to DataGrid


By : Hemendra Singh Bisen
Date : March 29 2020, 07:55 AM
To fix this issue My question is how to bind a List ( Which contains a List ) to a DataGrid in WPF , here you go
code :
    <DataGrid ItemsSource="{Binding Students}"
              AutoGenerateColumns="False"
              CanUserAddRows="False">
        <DataGrid.Columns>
            <DataGridTextColumn Binding="{Binding Name}"
                                Header="Name" />
            <DataGridTextColumn Binding="{Binding Marks[0]}"
                                Header="Mark1" />
            <DataGridTextColumn Binding="{Binding Marks[1]}"
                                Header="Mark2" />
            <DataGridTextColumn Binding="{Binding Marks[2]}"
                                Header="Mark3" />
        </DataGrid.Columns>
    </DataGrid>
    class Student
    {
        public String Name { get; set; }
        public List<String> Marks { get; set; }
    }
<DataGridTextColumn Binding="{Binding Marks[3]}"
                    Header="Mark4" />
Bind List<object> to Datagrid WPF, C#

Bind List<object> to Datagrid WPF, C#


By : JeremyJ
Date : March 29 2020, 07:55 AM
Any of those help Create a view model class with a property that holds a collection of VarConfig objects. The collection should notify the view about changes (like added or removed elements). An appropriate collection type would therefore be ObservableCollection:
code :
public class ViewModel
{
    public ViewModel()
    {
        VarConfigList = new ObservableCollection<VarConfig>();
    }

    public ObservableCollection<VarConfig> VarConfigList { get; private set; }
}
public MainWindow()
{
    InitializeComponent();

    var viewModel = new ViewModel();
    // fill viewModel.VarConfigList

    DataContext = viewModel;
}
<DataGrid ItemsSource="{Binding VarConfigList}" ...>
    ...
</DataGrid>
public class VarConfig : INotifyPropertyChanged
{
    public event PropertyChangedEventHandler PropertyChanged;

    private void OnPropertyChanged(string propertyName)
    {
        var handler = PropertyChanged;
        if (handler != null)
        {
            handler(this, new PropertyChangedEventArgs(propertyName));
        }
    }

    private int id;
    public int Id
    {
        get { return id; }
        set
        {
            id = value;
            OnPropertyChanged("Id");
        }
    }

    // similar code for the other properties
}
How to bind list of object to DataGrid in WPF

How to bind list of object to DataGrid in WPF


By : user2858530
Date : March 29 2020, 07:55 AM
fixed the issue. Will look into that further the answer below solves this problem, but I will suggest another way. As said above, first you need to add DataContext = this in your code-behide. Then just change the xaml markup as follows:
code :
     <Grid>
        <DataGrid ItemsSource="{Binding Words}" AutoGenerateColumns="False">
            <DataGrid.Columns>
                <DataGridTextColumn Header="Name" Binding="{Binding Name}"/>
                <DataGridTemplateColumn Header="Synonym and acronyms">
                    <DataGridTemplateColumn.CellTemplate>
                        <DataTemplate>
                            <StackPanel>
                                <ItemsControl ItemsSource="{Binding MeaningGroups}">
                                    <ItemsControl.ItemTemplate>
                                        <DataTemplate>
                                            <StackPanel Orientation="Horizontal">
                                                <ItemsControl ItemsSource="{Binding Synonyms}">
                                                    <ItemsControl.ItemsPanel>
                                                        <ItemsPanelTemplate>
                                                            <WrapPanel/>
                                                        </ItemsPanelTemplate>
                                                    </ItemsControl.ItemsPanel>
                                                    <ItemsControl.ItemTemplate>
                                                        <DataTemplate>
                                                            <Border BorderThickness="1" BorderBrush="Black" CornerRadius="5" Margin="5 5 0 0">
                                                            <TextBlock Margin="3" Text="{Binding}"/>
                                                            </Border>
                                                        </DataTemplate>
                                                    </ItemsControl.ItemTemplate>
                                                </ItemsControl>
                                                <ItemsControl ItemsSource="{Binding Acronyms}">
                                                    <ItemsControl.ItemsPanel>
                                                        <ItemsPanelTemplate>
                                                            <WrapPanel/>
                                                        </ItemsPanelTemplate>
                                                    </ItemsControl.ItemsPanel>
                                                    <ItemsControl.ItemTemplate>
                                                        <DataTemplate>
                                                            <Border BorderThickness="1" BorderBrush="Black" CornerRadius="5" Background="Red" Margin="5 5 0 0">
                                                            <TextBlock Margin="3" Text="{Binding}"/>
                                                            </Border>
                                                        </DataTemplate>
                                                    </ItemsControl.ItemTemplate>
                                                </ItemsControl>
                                            </StackPanel>
                                        </DataTemplate>
                                    </ItemsControl.ItemTemplate>
                                </ItemsControl>
                            </StackPanel>
                        </DataTemplate>
                    </DataGridTemplateColumn.CellTemplate>
                </DataGridTemplateColumn>
            </DataGrid.Columns>
        </DataGrid>
    </Grid>
DataGrid - Bind Custom object with sub List

DataGrid - Bind Custom object with sub List


By : Naveen Pantera
Date : March 29 2020, 07:55 AM
To fix the issue you can do you need to define the columns and bind inside the column definition.
The following will show the value of MySecondProperty.SubProperty in the second column
Related Posts Related Posts :
  • Replace a # character with a space and a # character
  • DataGrid SelectedItem and CurrentItem on row change and on loosing focus
  • Parse Json to class with C#
  • Publish .exe with Visual Studio Mac
  • c# out causing a no overload for method error?
  • Which Thread resume the method execution after await in Asp.net Web application
  • How to open Asp.Net project in another computer
  • Azure app registrations - SQL Server permission for C# App
  • How to Submit String with 536000 Characters to API
  • Server side TcpClient's stream.read gets no data when a different client (connected to the same port) sends data
  • Add combo-box in windows form grid view by using LINQ query
  • Remove XLL addin when multiple XLL addins are installed
  • Deserialize dynamic json into generic .NET object
  • How to search node in Jobject
  • Iron Webscraper connects to host but doesn't scrape?
  • Change values from textbox at the touch of a button
  • Data access structure with Entity Framework
  • Link Assemblys failed unexpectedly (Xamarin.ios.dll)
  • ASP.NET Core Razor pages - not binding on POST Request
  • How to update appsettings.json from wix custom actions with the values passed as parameter during command line installat
  • Load undefined images from folders
  • How to add a new button in title bar next the minimize button in UWP?
  • Missing DLL in docker image after copying published tree inside
  • One of the identified items was in an invalid format
  • TLS1.2 does not exist with .NET v4.7
  • How do I parse a XML document into object models?
  • Why is a conditional style being set on a html element by Razor is always html encoded incorrectly
  • Counting the amount of repetitions a letter has in a string
  • How to get the encoding of a file in a repository git via C#?
  • Communication between an Azure web application and a windows form app on Azure VM
  • WCF Service - Client receiving CommunicationException after many requests to localhost
  • How to correctly view pdf in browser using DotVVM?
  • Reading part of json into c# object
  • YoutubeAPI v3 - Setting thumbnail returns Completed status, but no thumbnail is set on video
  • Using the SimpleInjector, is it possible to get a singleton by its implementation type?
  • Why the LogLevel rule is not set for my NLog?
  • Converting short? to TimeSpan
  • Publish build artifact through build.cake instead of Azure Devops
  • Unable to get new token using JWT method (C#)
  • Running HttpRequest synchronously C#
  • How to avoid format in "XDocument.Parse(strHtml)"
  • How to update naviation property with new values in EF Core?
  • Queued function not executing with dequeue
  • How to Control Sequence of columns automatically Generated in DataGrid
  • Getting error when try to add a file from library to main project?
  • Aggregate Roots DDD/UoW/Repo/Service
  • How to change the horizontal movement direction of the player in Unity2D?
  • Getting a two dimensional array of all possible unique combination of numbers lower than a mixmum for each cell starting
  • How to get LDAP nested groups from attribute
  • Get array consisting of first values of a list of tuples
  • How do I pass information from my View to my Controller as a Parameter
  • UWP BarcodeScanner Preview: CaptureElement doesn't show any Preview
  • How to register open generic with custom factory method?
  • Change image via in scriptable object in Unity
  • Decreasing value of one float when other go up
  • Xceed CheckComboBox not properly showing selected values from items hardcoded in XAML
  • Why does char array display contents on console while string and int arrays dont in c#?
  • How to prevent custom filters twice calls?
  • c#: remove brackets of certain size if existing including its content
  • Is there a simple way of handling nested Dictionary<string, object> types where object is either string or another
  • shadow
    Privacy Policy - Terms - Contact Us © festivalmusicasacra.org