Click here to Skip to main content
15,885,216 members
Home / Discussions / .NET (Core and Framework)
   

.NET (Core and Framework)

 
GeneralRe: A General Question About DataGrid Controls Pin
Roger Wright21-Jan-11 17:17
professionalRoger Wright21-Jan-11 17:17 
GeneralRe: A General Question About DataGrid Controls Pin
Gregory Gadow24-Jan-11 17:57
Gregory Gadow24-Jan-11 17:57 
AnswerRe: A General Question About DataGrid Controls [modified] Pin
GenJerDan21-Jan-11 11:29
GenJerDan21-Jan-11 11:29 
GeneralRe: A General Question About DataGrid Controls Pin
Roger Wright21-Jan-11 17:12
professionalRoger Wright21-Jan-11 17:12 
QuestionReusable Lookup Control [modified] Pin
Ed Hill _5_20-Jan-11 0:06
Ed Hill _5_20-Jan-11 0:06 
AnswerRe: Reusable Lookup Control Pin
Ian Shlasko20-Jan-11 6:09
Ian Shlasko20-Jan-11 6:09 
GeneralRe: Reusable Lookup Control Pin
Ed Hill _5_20-Jan-11 22:15
Ed Hill _5_20-Jan-11 22:15 
GeneralRe: Reusable Lookup Control Pin
Ian Shlasko21-Jan-11 3:44
Ian Shlasko21-Jan-11 3:44 
Ed Hill _5_ wrote:
In answer to your above question, this is my first project that i have used both entity framework and WPF so i am learning as i go, and unfortunatly when i'm not sure how to do things i fall back on the old win forms way of working. I'll get there in the end its just a but of a learning process for me.

No problem... Sorry if that came off as hostile... Wasn't sure if you had an actual reason for doing it that way - Some situation that data binding couldn't handle. But if you're just new to WPF... Well, we were all new at some point. Took me a while to get the hang of it, but now WinForms seems almost backwards by comparison.

Generally, the goal in WPF is to completely separate the GUI from the code-behind... So the GUI knows nothing about the code and the code knows nothing about the GUI. Only the model is shared between them. The only time you should even have to assign a name to a WPF control and refer to it in the code, is for those odd situations where data binding isn't good enough.

If the code needs to make a change to the GUI, it should instead be doing something to the model, which the GUI would detect and react to. It sounds unnecessary, but it's actually pretty powerful.

For example, a button on the GUI could have its IsEnabled property bound to a boolean property on the model. The property changes and the button is now ready to be used. Sometime later, you could decide to overhaul the GUI and make it flashy and attractive, so instead of just having a button enable itself, you could have the infamous Clippy fly onto the screen and pop up a little speech balloon saying "All set! Click here!", and simultaneously have a custom animated button-type thing light up with blinking text and... well, you get the idea... All of that could be triggered just by setting that single boolean property on the model, and you could do all this without making a single change to the model or the business logic.

So in short... I think the Name property is the key... If you find yourself referencing a GUI control by name in the code, you need to take a step back and ask yourself if there's a better way.
Proud to have finally moved to the A-Ark. Which one are you in?
Author of the Guardians Saga (Sci-Fi/Fantasy novels)

GeneralRe: Reusable Lookup Control Pin
Ed Hill _5_21-Jan-11 1:50
Ed Hill _5_21-Jan-11 1:50 
AnswerRe: Reusable Lookup Control Pin
Ed Hill _5_21-Jan-11 5:58
Ed Hill _5_21-Jan-11 5:58 
QuestionPlease help on LINQ Order By in VB.NET Pin
kishan NM19-Jan-11 2:30
kishan NM19-Jan-11 2:30 
AnswerRe: Please help on LINQ Order By in VB.NET Pin
Ian Shlasko19-Jan-11 2:48
Ian Shlasko19-Jan-11 2:48 
GeneralRe: Please help on LINQ Order By in VB.NET Pin
kishan NM19-Jan-11 3:52
kishan NM19-Jan-11 3:52 
GeneralRe: Please help on LINQ Order By in VB.NET Pin
Ian Shlasko19-Jan-11 4:40
Ian Shlasko19-Jan-11 4:40 
GeneralRe: Please help on LINQ Order By in VB.NET Pin
kishan NM19-Jan-11 6:53
kishan NM19-Jan-11 6:53 
GeneralRe: Please help on LINQ Order By in VB.NET Pin
Ian Shlasko19-Jan-11 7:56
Ian Shlasko19-Jan-11 7:56 
AnswerRe: Please help on LINQ Order By in VB.NET Pin
dasblinkenlight19-Jan-11 4:49
dasblinkenlight19-Jan-11 4:49 
AnswerRe: Please help on LINQ Order By in VB.NET Pin
#realJSOP19-Jan-11 7:27
mve#realJSOP19-Jan-11 7:27 
QuestionUser account rights Pin
marca29217-Jan-11 0:50
marca29217-Jan-11 0:50 
AnswerRe: User account rights Pin
_Erik_17-Jan-11 3:07
_Erik_17-Jan-11 3:07 
GeneralRe: User account rights [modified] Pin
marca29217-Jan-11 21:32
marca29217-Jan-11 21:32 
AnswerRe: User account rights Pin
Ravi Sant18-Jan-11 1:12
Ravi Sant18-Jan-11 1:12 
QuestionWhen to Define a Custom Exception PinPopular
Patrick Skelton13-Jan-11 23:57
Patrick Skelton13-Jan-11 23:57 
AnswerRe: When to Define a Custom Exception PinPopular
Pete O'Hanlon14-Jan-11 0:13
mvePete O'Hanlon14-Jan-11 0:13 
AnswerRe: When to Define a Custom Exception PinPopular
Eddy Vluggen14-Jan-11 0:42
professionalEddy Vluggen14-Jan-11 0:42 

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.