Click here to Skip to main content
14,929,187 members
Home / Discussions / WPF
   

WPF

 
AnswerRe: UI not updating Pin
Gerry Schmitz29-Mar-21 9:15
mveGerry Schmitz29-Mar-21 9:15 
GeneralRe: UI not updating Pin
#realJSOP29-Mar-21 10:38
mva#realJSOP29-Mar-21 10:38 
GeneralRe: UI not updating Pin
Gerry Schmitz29-Mar-21 11:24
mveGerry Schmitz29-Mar-21 11:24 
GeneralRe: UI not updating Pin
#realJSOP29-Mar-21 12:07
mva#realJSOP29-Mar-21 12:07 
GeneralRe: UI not updating Pin
Gerry Schmitz29-Mar-21 12:19
mveGerry Schmitz29-Mar-21 12:19 
GeneralRe: UI not updating Pin
#realJSOP29-Mar-21 23:33
mva#realJSOP29-Mar-21 23:33 
GeneralRe: UI not updating Pin
Richard Deeming29-Mar-21 21:36
mveRichard Deeming29-Mar-21 21:36 
GeneralRe: UI not updating Pin
#realJSOP29-Mar-21 23:42
mva#realJSOP29-Mar-21 23:42 
GeneralRe: UI not updating Pin
Richard Deeming30-Mar-21 0:05
mveRichard Deeming30-Mar-21 0:05 
GeneralRe: UI not updating Pin
#realJSOP30-Mar-21 5:12
mva#realJSOP30-Mar-21 5:12 
GeneralRe: UI not updating Pin
#realJSOP30-Mar-21 12:14
mva#realJSOP30-Mar-21 12:14 
GeneralRe: UI not updating Pin
#realJSOP30-Mar-21 14:26
mva#realJSOP30-Mar-21 14:26 
QuestionImpossible? Get instance of MainWindow from extern WPF-application Pin
Mc_Topaz22-Mar-21 14:05
MemberMc_Topaz22-Mar-21 14:05 
AnswerRe: Impossible? Get instance of MainWindow from extern WPF-application Pin
Richard Deeming22-Mar-21 22:40
mveRichard Deeming22-Mar-21 22:40 
GeneralRe: Impossible? Get instance of MainWindow from extern WPF-application Pin
Mc_Topaz23-Mar-21 4:02
MemberMc_Topaz23-Mar-21 4:02 
AnswerRe: Impossible? Get instance of MainWindow from extern WPF-application Pin
Gerry Schmitz23-Mar-21 7:27
mveGerry Schmitz23-Mar-21 7:27 
GeneralRe: Impossible? Get instance of MainWindow from extern WPF-application Pin
Mc_Topaz23-Mar-21 12:22
MemberMc_Topaz23-Mar-21 12:22 
GeneralRe: Impossible? Get instance of MainWindow from extern WPF-application Pin
Richard Deeming23-Mar-21 23:14
mveRichard Deeming23-Mar-21 23:14 
GeneralRe: Impossible? Get instance of MainWindow from extern WPF-application Pin
Gerry Schmitz24-Mar-21 5:40
mveGerry Schmitz24-Mar-21 5:40 
GeneralRe: Impossible? Get instance of MainWindow from extern WPF-application Pin
Mc_Topaz25-Mar-21 0:02
MemberMc_Topaz25-Mar-21 0:02 
QuestionWPF DataGrid Custom Group Header Pin
Kevin Marois22-Mar-21 8:47
professionalKevin Marois22-Mar-21 8:47 
AnswerRe: WPF DataGrid Custom Group Header Pin
Richard Deeming22-Mar-21 22:35
mveRichard Deeming22-Mar-21 22:35 
QuestionDynamic WPF DataGrid Pin
Kevin Marois19-Mar-21 10:41
professionalKevin Marois19-Mar-21 10:41 
I need to automatically generate a WPF DataGrid at runtime. Some of the columns will be known, and some will be added based off user selections. In all cases, I'll know the data types. The column definitions will all be rows in some table, allowing me to create any number of columns.

The problem that I'm going to run into is binding. Since there will be an unknown number of columns, I can't create an "concrete" entity to bind to. So, the real question here is how to represent the data when I don't know all the columns.

I came across some examples of ExpandoObject usage and put together this sample:
static void Main(string[] args)
{
    // Assigning properties and their values at runtime
    var x = new ExpandoObject() as IDictionary;
    x.Add("NewProp", "Hello World!");

    IDictionary propertyValues = x;
    foreach (var property in propertyValues.Keys)
    {
        Console.WriteLine(String.Format("{0} : {1}", property, propertyValues[property]));
    }

    // Creating properties in code and assigning data at runtime
    dynamic expando = new ExpandoObject();
    expando.SomeStringProp = "C";
    expando.SomeNumberProp = 12;

    expando.MyMethod = new Func(() =>
    {
        return 55;
    });

    Console.WriteLine(expando.SomeStringProp);
    Console.WriteLine(expando.SomeNumberProp);
    Console.WriteLine(expando.MyMethod());
    Console.ReadLine();
}
I'm concerned about performance here. If anyone has a better way I'd like to hear about it.

Thanks!
If it's not broken, fix it until it is.
Everything makes sense in someone's mind.
Ya can't fix stupid.


modified 19-Mar-21 16:58pm.

AnswerRe: Dynamic WPF DataGrid Pin
Richard Deeming21-Mar-21 22:50
mveRichard Deeming21-Mar-21 22:50 
GeneralRe: Dynamic WPF DataGrid Pin
Kevin Marois22-Mar-21 7:07
professionalKevin Marois22-Mar-21 7:07 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.