|
Indeed, I was going to recommend an observable collection; but he said he did not want any databinding.
Come to think of it; why do you not want databinding? Just curious.
|
|
|
|
|
BlitzPackage wrote: why do you not want databinding?
Masochism - plain and simple masochism.
|
|
|
|
|
Haven't got round to learning databinding yet, just trying a few simple things with basics.
when i tried the solution above i get
Error 1 'BikeMaint.Modules.AccessDB.GetBikesAlreadyStored(BikeMaint.Window1)' is inaccessible due to its protection level G:\Programming\Projects\bikemaint\Window1.xaml.cs 103 18 BikeMaint
?
|
|
|
|
|
It means that the method GetBikesAlreadyStored isn't declared as public or internal (assuming it's all in the same assembly) so it can't be accessed by an object outside its class. You've probably got it declared as private or protected (or without a scope identifier at all).
|
|
|
|
|
hi guys
i have some class libraries created in 2.0 , i want to to now create a silverlight project and want to use my previously created classes by i cant add reference in silver light project and also when i add reference into my wcf (which is a web application ) it gives me some reference error .
how to do that ?
any example
thanks in advance
....
Tauseef A Khan
MCP Dotnet framework 2.0.
|
|
|
|
|
Hello,
Silverlight is using smaller version of CLR which is totally different from .NET CLR. So, the assembly which is complied using Silverlight CLR and the .NET assembly are not binary compatible. That's why you can't reference .NET dll in Silverlight project.
You will need to re-compile your sourcecode with Silverlight CLR if you want to add the reference in Silverlight.
All you need to do is that create Silverlight Class Library and copy all of your code from your project to new Silverlight Class Library project and try to build it again. There are a lot of namespaces that are not supported in Silverlight so that you have to find the workaround for them. Once you can successfully compile the project, you will get the assembly that you can reference in Silverlight.
Hope it helps.
|
|
|
|
|
Hi All,
This is only slightly related to WPF really. I'm currently overhauling my personal web site and I'm including lots of code bits (C# & XAML).
The problem is, I'm having troubles finding decent syntax highlighting stuff that does C# and XAML to an acceptable standard. The site is php/html/javascript so I can't use any nice asp.net stuff ... boo!
Any one have any ideas?
The syntax highlighters I've found so far are ok, but XAML highlighted as XML just doesn't cut it imho ...
Cheers,
|
|
|
|
|
I cheat on my blog, I post screenshots of the code.
|
|
|
|
|
tut tut Peter ...
To be honest, over the last couple of years I've lost track of the number of Syntax Highlighters I've tried and frankly I've not been completely satisfied with any of them ...
XAML is completely unrepresented at the moment as far as I can tell.
|
|
|
|
|
Jammer wrote: XAML is completely unrepresented at the moment as far as I can tell.
Too true. That's why I use screenshots (btw - that's how Josh and Karl do it as well).
|
|
|
|
|
|
It looks good. I'm playing round with a Silverlight code control as a bit of fun. So far, it's been pretty good fun.
|
|
|
|
|
I so want to move my hosting so that I can use .NET on my site!
|
|
|
|
|
Notepad++ (free) highlights pretty well and you can export in HTML.
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Good grief! I use Notepad++ all the time ... never noticed that!!!! Off to have a rummage ...
Thanks!
|
|
|
|
|
Heh. After I posted I noticed you stated XML highlighting wasn't acceptable,
so you may not like it
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Well, really that's just me being anal about it. I just wanna have XAML snippets on my site in the exact format one gets used to viewing it on screen. I actually find code more difficult to read if the highlighting is wrong than with no highlighting at all!
|
|
|
|
|
Yeah
Not nearly as difficult to me as trying to copy code from a screenshot hehe.
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
haha!
|
|
|
|
|
That's why the friendly screenshot people provide downloads.
|
|
|
|
|
Hi there,
I've found this article by Bea Stollnitz and downloaded the source and converted to vb.net. I believe I have my conversion complete, but one thing is still not working as I've tried to get it and pulled too many hairs out. Hopefully someone can help me spot what I'm missing.
Ok, drag & drop works fine in the converted code, I just don't get the InsertionAdorner working in vb.net, I've setup breakpoints in code and all code is being executed, but for the life of me the InsertionAdorner does not become visible. Even the DrawLine functions are being called!
I'm at a loss and I need this in vb.net, the original C# project works just fine, I just can't find out what I'm missing!
Thanks,
Scott
|
|
|
|
|
If you want to convert this to VB.NET, use Reflector to open the exe up in Bea's solution (File > Open... pick the file). Then, expand the various items in DragDropListBox and choose Visual Basic in the language combo. Click Space to see the Disassembler window, and choose each class (e.g. Album) in turn. At the bottom of the Disassembler window is a link "Expand Methods" - click this to see the converted code.
|
|
|
|
|
Thanks for your reply, I'll give Reflector a go to see if I can see something, but with my experience the code that comes out of reflector can be somewhat cryptic at best. I did supply my attempt at converting the code in my original message, not sure if you downloaded and looked at it, the code I have compiles and runs fine in VB.net, just missing the InsertionAdorner working.
Anyone willing to take a look at my already attempt at converting?
Thanks,
Scott
|
|
|
|
|
Got it, with the help of Reflector.
The online converter took this code
pen = new Pen { Brush = Brushes.Gray, Thickness = 2 };
and spit out
pen = New Pen()
conveniently leaving out the
pen.Brush = Brushes.Gray
pen.Thickness = 2
and a couple other conversions that I had to fix that were similar.
The converter could of done:
pen = New Pen() With {.Brush=Brushes.Gray, Thickness=2 }
but to play it safe because VS08 only supports that it just left it out..
Problem fixed!
|
|
|
|
|
I am trying to make a simple WPF app that takes a regex typed by the user into one RichTextBox, and highlights the matches in a second RichTextBox where the user can type in test data.
I will admit that this is my first foray into WPF, and theres probably something I am doing wrong. I am having two problems:
1. My highlights are not showing up in the right place.. they are off by a couple of characters early in the document, and towards the end they are nowhere close.
2. The performance I am seeing is abominable To highlight about 200 three-character matches in a ~60kb document is taking over ten seconds. There are scenarios where I would need to highlight thousands of matches instead.. I can't fathom how long that would take. I am pretty certain the slow-down is in the action of highlighting, not processing the regex itself.
Just pasting the plain text into the RichTextBox in the first place (where it isnt executing any of my code) takes at least three seconds.
This is a rewrite of a windows forms app that I made a couple of years ago, and I managed to skirt around some of the RichTextBox performance issues there by using Suspend/ResumeLayout() but there doesn't appear to be an analogous tactic in WPF..
I should probably also note that no exceptions are actually being thrown. This was my first guess for the slow-down issue since exceptions take a while to churn out.. but the catch(...) in my code isn't being hit...
My machine is a Pentium 4 2.2ghz running Windows XP SP2. Here is the meat of my code.. what am I doing wrong?
void HighlightRegexMatches()
{
if (!pHighlighting)
{
pHighlighting = true;
Regex r = null;
string p = new TextRange(
rtbPattern.Document.ContentStart,
rtbPattern.Document.ContentEnd
).Text.Replace("\r\n", "");
try
{
r = new Regex(p);
}
catch (Exception ex)
{
pHighlighting = false;
}
if (r == null) return;
try
{
string s = new TextRange(
rtbTestData.Document.ContentStart,
rtbTestData.Document.ContentEnd
).Text;
MatchCollection c = r.Matches(s);
FlowDocument d = rtbTestData.Document;
TextRange allText = new TextRange(d.ContentStart, d.ContentEnd);
allText.ApplyPropertyValue(TextElement.BackgroundProperty, Brushes.Transparent);
int count = 0;
foreach (Match m in c)
{
TextPointer start = d.ContentStart.GetPositionAtOffset(m.Index);
TextPointer end = d.ContentStart.GetPositionAtOffset(m.Index + m.Length);
TextRange t = new TextRange(start, end);
t.ApplyPropertyValue(TextElement.BackgroundProperty, Brushes.HotPink);
count++;
}
}
catch (Exception ex)
{
}
finally
{
pHighlighting = false;
}
}
}
|
|
|
|