|
I need a quick tutorial on how to build a wpf app without any IDE. I want to know this because Visual Studio generates a bunch of code and it attempts to hide most of it and the designer code just looks like a mess. I want to know the simplest COMPLETE boiler plate code nessecary to display a window with a button on it using XAML and C# using notepad and the command-line. I googled around but I cant seem to find what I want.
Word, write letters and sh*t yo.
It takes 46 muscles to frown but only 4 to flip 'em the bird.
Friendship is like peeing on yourself: everyone can see it, but only you get the warm feeling that it brings.
The greatest pleasure in life is doing what people say you cannot do.
Everyone needs believe in something. I believe I'll have another beer.
|
|
|
|
|
CataclysmicQuantum wrote: I googled around but I cant seem to find what I want.
Yeah that was tough[^]
two clicks away to this[^]
Building a WPF Application (WPF)
Windows Presentation Foundation (WPF) applications can be built as .NET Framework executables (.exe), libraries (.dll), or a combination of both types of assemblies. This topic initially shows how to build simple WPF applications from the command prompt, before showing how WPF leverages the extensibility of Microsoft build engine (MSBuild) to build more complex applications. This topic finishes by providing an in-depth discussion of the key steps in the MSBuild build process.
led mike
|
|
|
|
|
I had found that when I was looking, thats not quite what I am looking for.
I know how to use the command-line and all that. I just need a very simple tutorial that says something like "Create .cs file with class Program with Main(), add this code to it, create .xaml file...." Notice the 1 star rating on that MSDN article. I'm not the only one who doesn't liek it.
Word, write letters and sh*t yo.
It takes 46 muscles to frown but only 4 to flip 'em the bird.
Friendship is like peeing on yourself: everyone can see it, but only you get the warm feeling that it brings.
The greatest pleasure in life is doing what people say you cannot do.
Everyone needs believe in something. I believe I'll have another beer.
|
|
|
|
|
|
Thats perfect, thanks.
Word, write letters and sh*t yo.
It takes 46 muscles to frown but only 4 to flip 'em the bird.
Friendship is like peeing on yourself: everyone can see it, but only you get the warm feeling that it brings.
The greatest pleasure in life is doing what people say you cannot do.
Everyone needs believe in something. I believe I'll have another beer.
|
|
|
|
|
I'd help you, but the drug rehab is shut right now.
WPF - Imagineers Wanted
Follow your nose using DoubleAnimationUsingPath
|
|
|
|
|
Is it possible to get the name of the DLL your code is executing in?
For instance, I have MyLib.DLL that contains the class "MyClass". Inside MyClass, I have a function that needs to know the name of the DLL it's running in.
How does one accomplish that in .Net?
It's done like this:
Module mod = Assembly.GetExecutingAssembly().GetModules()[0];
string name = mod.Name;
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
modified on Wednesday, January 23, 2008 11:32:24 AM
|
|
|
|
|
Assembly.GetExecutingAssembly().FullName will get the name of the assembly. Assembly.GetExecutingAssembly().Location will get the location of the assembly.
I'm going to become rich when I create a device that allows me to punch people in the face over the internet.
"If an Indian asked a programming question in the forest, would it still be urgent?" - John Simmons / outlaw programmer
|
|
|
|
|
Hello!
I'm stuck with the following problem:
I've created a base class
<br />
public abstract class GenericFieldBase<><br />
from which I derived a number of child classes such as
<br />
public class StringField : GenericFieldBase<string>;<br />
public class IntegerField : GenericFieldBase<int>;<br />
public class DoubleField : GenericFieldBase<double>;<br />
public class DateTimeField : GenericFieldBase<DateTime>;<br />
Question is: what type should a variable have to contain either of these derived classes?
<br />
GenericFieldBase<...> var;<br />
<br />
var = new StringField();<br />
var = new DoubleField();<br />
var = new DateTimeField();<br />
thank you very much!!
-- edit: now alle brackets should be in place.
modified on Wednesday, January 23, 2008 10:45:57 AM
|
|
|
|
|
A variable of type GenericFieldBase can contain an instance of any class derived from GenericFieldBase.
|
|
|
|
|
I'm not quite shure whether I understand corretly.
For 'normal' types I know that typing
<br />
BaseClass var = new DerivedFromBaseClass();<br />
is possible.
But when generics come into play I normally have to give a type argument between < > brackets.
Back to the first example: I could write
<br />
GenericFieldBase<string> var_string;<br />
GenericFieldBase<double> var_double;<br />
GenericFieldBase<datetime> var_datetime;<br />
<br />
var_string = new StringField(); <br />
var_double = new DoubleField();<br />
var_datetime = new DateTimeField();<br />
But what I really want is a variable of type GenericBaseField which can hold a derived class of any generic type. But simply typing
<br />
GenericFieldBase var;<br />
var = new StringField()<br />
gives compile error:
"Using the generic type 'generic type' requires 'number' type arguments "
-- edit: corrected missing brackets
modified on Wednesday, January 23, 2008 10:51:27 AM
|
|
|
|
|
The syntax you gave for GenericFieldBase looked non-generic because there were no angle brackets <> in the declaration. A specific example would clarify your situation.
If C# won't let you derive a class from a generic, you can define a non-generic base class that has a generic member. This may give you the flexibility you need because the derived classes can then use the generic member in different ways.
As a last resort, you can use type "object", which can hold anything. (Sort of like a void pointer in C++).
|
|
|
|
|
Unless I'm missing something in your post - GenericFieldBase isn't actually a generic class. Therefore, you could simply do this:
GenericFieldBase var = new StringField();
|
|
|
|
|
It appears not all your '<' and '>' characters got posted correctly. See if you can edit your post so they are all visble.
led mike
|
|
|
|
|
You have to make a non generic base or interface to handle this.
eg:
public abstract class GenericFieldBase<T> : FieldBase
and then you put all the non generic methods , eg object GetValue() into the nongeneric base
FieldBase var = new StringField();
However, this will most likely defeat the purpose of what you are trying to do, I guess that you are trying to avoid boxing.
So there really isnt any good way to accomplish this.
simply because you cannot assign a concrete implementation of your genericfieldbase to the template "genericfieldbase"
GenericFieldBase<string> will become a separate concrete class in runtime that inherits object , not inheriting your generic base.
|
|
|
|
|
ok,
that puts me back to the drawing board. Thank you very much for your advice.
It nevertheless feels a bit strange. Is it really intended to behave like this? I mean: isn't this a bit of a flaw? After all it limits the usefulness of generics.
whatever.
Thank you very much for your advice.
Arne
|
|
|
|
|
ArneKruger wrote: Is it really intended to behave like this? I mean: isn't this a bit of a flaw? After all it limits the usefulness of generics.
No, you are wrong. Generics is about strong typing[^]. The intention of your original post appears to be the opposite of strong typing as in the case of scripting languages such as Javascript.
led mike
|
|
|
|
|
|
What you will want to do is open up a FileStream to a specified file, and use a StreamWriter to write to that file. Get the SelectedIndices from your ListView , get the values, seperate them with a comma, and use the Write method on your StreamWriter to write to your file.
I'm going to become rich when I create a device that allows me to punch people in the face over the internet.
"If an Indian asked a programming question in the forest, would it still be urgent?" - John Simmons / outlaw programmer
|
|
|
|
|
John first of all i would like to pay thanks to u that u replied ,
I told u that i m new to c# and i want to write data from list view . can u send me some code about this . when i clik button so the selected items from the list view log into .csv file.
hope u will send me some code .
thanks u so much John.
Tahir
|
|
|
|
|
You might actually want to get his name right. His name is not John - that's the name of a guy in he's quoting in his sig. You might get more of a response if you actually use his right name.
|
|
|
|
|
Using pseudocode:
create a stream file with csv extension;
foreach string s in listviewheaders
stream.write(s+",")
stream.writeline()
foreach listviewitem lvi in listviewitems
{
foreach string s in lvi.Items 'or if you want to check selected items use the SelectedItem property
stream.write(s+",")
stream.writeline()
}
Regards,
Thomas Stockwell
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
Visit my homepage Oracle Studios[ ^]
|
|
|
|
|
thank you Thomas.
I could't understand till now that how i can use this code?
and how i can read each row from list view and write it to csv file?
The Items in the listview are given as :
Name ID Age Phone # Address Salary Job
johny 567 25 1252244 street# 10 19000 programer
Ibrham 78 45 76877 str #67 20000 designer
tony 233 32 3232 str # 32 16888 QualityA
I have rows and columns like this and i wants to write it into .CSV format by clicking on "Create File" button so after doing this the data will be save in csv file as it is in list view.
if you have an idea about this program then write the specific code and tell me that how i can use this code.
thanks.
Tahir
|
|
|
|
|
Hi,
I'm trying to bind a listbox to a object that provides the listbox text:
lineList.DataSource = flatFileMgr;
where flatFileMgr implements IList:
public class FlatFileMgr : IList<string>
I get the following error: "Complex DataBinding accepts as a data source either an IList or an IListSource."
But flatFileMgr IS an IList! This is maddening! Any suggestions?
|
|
|
|
|