|
Member 14058802 wrote: it seems WPF is the way to go?
Um ... not sure about that: WPF Dead or Not?[^]
There doesn't seem to be much support of / for WPF at MS - UWP and Xamarin Forms appear to be getting all their attention.
And my personal impression is: nice idea, badly implemented in VS. The designer is a true PITA after the simplicity that is WinForms! Doing anything pretty much means manual editing of the XML.
Sent from my Amstrad PC 1640
Never throw anything away, Griff
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Thanks for the feedback Griff.
I'm 41 and so have plenty of experience of Microsoft technologies getting ummm... 'Microsofted'? I guess this is one of those times.
So, I'm already feeling like it might be a good idea to drop back to WinForms? or is there a better way that I've not even found yet?
I've only built about 6 windows in wpf and the c# can be tweaked back to fit Winforms, so it won't be a problem. I'd just like some help to get pointed in the right direction if that's ok!
Best Regards,
James
|
|
|
|
|
Wait and see what others say - I've been wrong before.
WPF just doesn't feel "finished" - the framework support is good, but the designer stuff feels like "version 0": thrown together to test the tech rather than written for release to devs.
Sent from my Amstrad PC 1640
Never throw anything away, Griff
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Ok so, problem solved!
I'm going to thank Griff (Thanks Griff!)
After the last update, I decided to go for a walk with the dog and contemplate a possible move back to Forms. I'm not great with C# but I'm enjoying it. I reasoned that maybe I need to stick with Forms which are more familiar, so that I can stick to learning C# better and then maybe move to WPF later on.
I think maybe the fresh air awakened some brain cells as it dawned on me that this isn't a WPF problem, it's a C# problem... or rather a me forgetting the fundamentals of access modifiers problem. As soon as I realised, the dog just got a shorter walk then normal (sorry dog lol).
Sorry to waste your time Griff, but thanks for the chat.
As soon as I changed the logwindow instance to static, and called the LogUpdater method from the child Window it worked!
private static LogWindow LogWindow = new LogWindow();
public static void LogUpdater(string stringUpdate)
{
LogWindow.LogTextBox.Text += stringUpdate + "\r\n";
}
James Wyatt - Putting the fun back into fundamentals!
|
|
|
|
|
|
|
I'd really enjoy reading an article from you describing your experience with these newer tools. Is the "desktop bridge" usable without high-overhead ?
thanks, Bill
«Where is the Life we have lost in living? Where is the wisdom we have lost in knowledge? Where is the knowledge we have lost in information?» T. S. Elliot
|
|
|
|
|
I'm going to dispute OG assumption that WPF is dying or dead (I'm the dev who is still pissed at Silverlights demise so...) WPF has a steep learning curve especially from winforms. I found it well worth the effort as once you get moderately proficient production is fairly rapid.
Work through a few tutorials, get familiar with MVVM, I use the GalaSoft framework because it is really minimalist.
One additional benefit is that Xamarin forms seem to be based on the same xaml concepts.
Never underestimate the power of human stupidity -
RAH
I'm old. I know stuff - JSOP
|
|
|
|
|
Thanks Mycroft. I'll take a look. I'd not heard of Galasoft yet, but yes, MVVM references keep popping up during my travels.
|
|
|
|
|
Lots of options:
public string TheText { get; set; } = "Bound value";
private void UxOK_Click( object sender, RoutedEventArgs e ) {
Window log = new Window();
TextBlock tb = new TextBlock();
tb.FontSize = 24;
log.Content = tb;
tb.Text += "Good" + Environment.NewLine;
tb.Text += "Bye";
log.Show();
}
"(I) am amazed to see myself here rather than there ... now rather than then".
― Blaise Pascal
|
|
|
|
|
Hi,
i have a report with the below structure
<group 1="">
<group 1="" header="">
<group2 footer="">
i'm trying to export this report to excel with repeated headers and footers with N number of rows to print the report..
After setting the page break calculations and repeat header and footers, the report does not break with the exact N number of rows..
i have few merged rows inside the report and conditions to hide rows..
Appreciate if some one could help me to achieve this... its really urgent
thanks in advance
|
|
|
|
|
This issue I have it for a while, almost 1 year or more. I tried diverse permutations but always got stuck at some point, when the whole idea will not work anymore. And I give up all the time on it.
I have a class with properties, fields and methods in it. I am thinking to add events to it, but im not that great at them yet. When i call this class into form1 I basically change some values inside class, and the "object" that represents it, will add value or change color or change position ,etc.
If i have a game let's say, when the character stays and I want him to look like it's breathing, this property should be inside the class? or outside, letting me choose when to breathe, how much, how long, how fast,etc. It's just an example. I had a lot of similar (and more complex) encounters with this subject and I simply freeze in the middle of it, not knowing how to manage it anymore.
Both ways are good! From outside or from inside class. But... sometime i need maneuverability, sometime is just in the way and i want it 'there' behind some close door(inside class I mean).
What your rules say about this thing? Should I change its values from inside the class? Or from outside?
Thank you.
------
thanks to OriginalGriff i relocated here the question.
q12
|
|
|
|
|
Don't sweat it, it's something you will learn to decide better as time goes.
As a rule, if your property has public setter it implied people will set it from outside!
Property usually have very simple set/get behaviour. But you could imagine the class having an Update() method that does some property updating.
As well as an external agent modifying them wen needed.
|
|
|
|
|
_Q12_ wrote: If i have a game let's say, when the character stays and I want him to look like it's breathing, this property should be inside the class? or outside, letting me choose when to breathe, how much, how long, how fast,etc. It's just an example. Inside, since it is part of.
_Q12_ wrote: Both ways are good! Nope.
Breathing would be done by a "AirSupplier", a base class that both Lungs and Gills inherit from. That way you can instantiate a fish with gills, and a rat with lungs. Add an IBreathable interface for quick filtering of breathing things.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
"If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
|
|
|
|
|
Your character (class) could have a "Timer" that regulates breathing (and maybe another "ticker" for a heart).
Then you can "attach" (using "component composition") an air supply to your character.
Inside the air supply, you can have another timer so that eventually the air "runs out".
You can attach a "progress bar" (another component) to your character that goes to blue as air runs out.
Think "components"; and how to build more complicated components and scenarios from them.
"(I) am amazed to see myself here rather than there ... now rather than then".
― Blaise Pascal
|
|
|
|
|
Hello friends,
I am working on a bio metric project, it returns a blob and we need to save it in Mysql Database,
I would like to ask how a blob is saved into mysql database when we have it in a byte array.
Thanks in advance.
|
|
|
|
|
Create a connection, issue appropriate command.
c# - Saving Byte[] Array to MYSQL - Stack Overflow[^]
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
"If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
|
|
|
|
|
hi all, I have a base class usercontrol consisting of the usual text boxes , labels etc which I have subclassed into several other classes and have a problem in that when I open any of the sub classes in the VS designer all of the controls ( buttons etc... ) are locked and i can't delete or change any properties - any ideas ? It's been a long time since I've done any Winform work so bear with me
We can’t stop here, this is bat country - Hunter S Thompson RIP
|
|
|
|
|
If the buttons etc. are part of the base class, then you can't move them in the designer by editing the derived class - if you think about it that's the only sensible way to go, as your base class could be in a compiled DLL instead of being available via source code (and thus can't be changed anyway!)
You should see a little padlock at the top left of base class controls indicating they can't be moved or deleted.
Sent from my Amstrad PC 1640
Never throw anything away, Griff
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Yes I suppose that's true - basically what I'm doing is dynamically loading the user controls into tab pages at runtime - some of them require slight modifications to the layout depending which page they are part off - I'll have to think of another way of achieving it - thanks for replying
We can’t stop here, this is bat country - Hunter S Thompson RIP
|
|
|
|
|
You're welcome!
Sent from my Amstrad PC 1640
Never throw anything away, Griff
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
You can manipulate the Controls in sub-classed Controls (or Forms) at run time.
If you're really interested in "getting deep," I'll show you how it is done ... and I do not refer to the hack of changing the Designer 'cs file access type to 'public for UserControls.
Let me know if you want to go further: I'm burned out on posting code here that gets no response.
cheers, Bill
«Where is the Life we have lost in living? Where is the wisdom we have lost in knowledge? Where is the knowledge we have lost in information?» T. S. Elliot
|
|
|
|
|
Definitely interested Bill
We can’t stop here, this is bat country - Hunter S Thompson RIP
|
|
|
|
|
Okay, keeping in mind what OriginalGriff said about not being able to move sub-classed Controls at design-time ... or edit any of their properties ...
By "publishing" a data structure that exposes the run-time created Controls: you can modify them any way you like. I prefer to create a Dictionary<string, Control> ... and, here's how I do that: note the code you see here uses Extension methods in the 'ControlExtensions class appended to this post ... depending on task at hand, I may want only to expose the top-level Controls, or I may want to recurse to get nested Controls.
Example: In the sub-classed UserControl Load EventHandler:
public Dictionary<string, Control> ControlDict;
private void SubClassOfBaseUserControl_Load(object sender, t[EventArgs e)
{
ControlDict = this.Controls.FindAll();
ControlDict["button1"].Text - "changed."
} The limits of this are, of course, that you can't access the unique properties of Controls ... those which are not inherited from Control ... unless you up-cast back to their native Type. That's as simple as using 'as, or as complex as using reflection when you don't know the Type to up-cast to.
Hope this helps, and I;m not saying you should do things this way. cheers, Bill
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
namespace YourNameSpace
{
public static class ControlExtensions
{
public static Dictionary<string, Control> FindAll(this Control.ControlCollection controls, bool recurse = true)
{
if (recurse)
{
return GetAllControls(controls).ToDictionary(c => c.Name, c => c); ;
}
else
{
return controls.Cast<Control>()
.ToDictionary(c => c.Name, c => c);
}
}
public static IEnumerable<Control> GetAllControls(Control.ControlCollection controls)
{
Stack<Control> stack = new Stack<Control>(controls.Cast<Control>().ToArray());
while (stack.Any())
{
var nextControl = stack.Pop();
foreach (Control childControl in nextControl.Controls)
{
stack.Push(childControl);
}
yield return nextControl;
}
}
}
}
«Where is the Life we have lost in living? Where is the wisdom we have lost in knowledge? Where is the knowledge we have lost in information?» T. S. Elliot
|
|
|
|
|
Whoah interesting stuff Bill, did you ever find a way of visually removing controls ?
We can’t stop here, this is bat country - Hunter S Thompson RIP
|
|
|
|