Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
P

pbalaga

@pbalaga
About
Posts
22
Topics
7
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • DataTemplate with List binding
    P pbalaga

    I don't get the point. Did you mean adding multiple textboxes to that StackPanel?

    WPF wpf wcf help tutorial question

  • DataTemplate with List binding
    P pbalaga

    Thank you for your time! This should be enough in some cases, including my current issue, but it seems somewhat less flexible. Let me be a bit curious, so what if an user wants to write his own style(?) and have the data separated with semicolons, not commas? May seem overcomplicated, but I'm asking, because it may happen that the end-user will be unable to change the data input. So the List<int> will be always a List<int> without a chance to wrap it as above. Thanks once again! Anyway I've just found a site about converter binding in xaml and I think it can be highly educational.

    WPF wpf wcf help tutorial question

  • DataTemplate with List binding
    P pbalaga

    Hi, I managed to bring to work simple data template in a ListView control:

    <DataTemplate>
    <TextBox Text="{Binding Path=boo}" />
    </DataTemplate>

    Class of the items added to the ListView contains property 'boo' of type string. But how to do similar binding for a custom complex type. Let's say instead of string boo, I have List<int> integers;. What I'm trying to achieve is to make the textbox display the numbers in the list separated with commas (e.g. 3,5,15,2). In other words, is it possible to do something like

    <TextBox Text="{Binding Path=integers}" />

    by providing how the target should be formatted? The main issue is that it should be a two-way binding (with ability to convert "1,5,4" back to List). What direction to go? I assume I could implement a string property, i.e. 'NumbersString' returning joined contents of the list in form of a single string. Or maybe it has something to do with converters? I only hope my explanation is clear enough. Thanks in advance, Paul

    WPF wpf wcf help tutorial question

  • Abstracts: can I do better than this?
    P pbalaga

    Afaik, the 'is' keyword is not fully equal to x.GetType() == typeof(y) . Let's say I have: class A class B:A (B inheriting from A) Then following (pseudo-)code:

    b = new B();
    b is A

    returns true and

    b = new B();
    b.GetType() == typeof(A)

    returns false. The latter option checks for an exact type match.

    C# question

  • WndProc equivalent in WPF?
    P pbalaga

    Thanks for your reply. Of course, it should do the job. Anyway, it seems to be a pretty strange work-around. You're provided with dozens of overridable methods for handling input, but you have to use native hooks...

    WPF csharp wpf winforms question

  • WndProc equivalent in WPF?
    P pbalaga

    Is there a single method in WPF that can handle all types of input at once, like WndProc in Windows Forms? Or do I have to capture and forward each event separately?

    WPF csharp wpf winforms question

  • [WPF] XamlParseException ----&gt; The calling thread must be STA
    P pbalaga

    Oh, excellent remark. LoadComponent() is working flawlessly from now on. Thank you for your help and time.

    WPF wpf csharp html com design

  • [WPF] XamlParseException ----&gt; The calling thread must be STA
    P pbalaga

    Thanks for your response. I've managed to overcome the problem, but rather by changing my approach than by understanding what's actually wrong. I was not loading the mentioned file on a separate thread explicitly. Maybe the system was doing something alike without letting me know. Anyway, I tried to run that WPF application with a custom Main() method. (I didn't alter the auto-generated entry point file, but created my own basing on WinForms experience.) It was like that:

    Main()
    {
    DerivedAppClass app = new DerivedAppClass();
    app.Run();
    }

    DerivedAppClass was located in an external dll as an extension of the WPF's Application class. It's obvious, but seems to be not that straightforward in WPF. After I started following the default scheme(App.xaml + App.xaml.cs), it's working as expected.

    WPF wpf csharp html com design

  • [WPF] XamlParseException ----&gt; The calling thread must be STA
    P pbalaga

    Hi, currently I'm testing a really small WPF app that uses resources from external sources and at first it appeared to work fine. Now, magically, it's not even able to load a resource from the same assembly. The following code:

            Uri uri = new Uri("thewinda.xaml", UriKind.Relative);
            Window w = Application.LoadComponent(uri) as Window;
    

    causes a XamlParseException with the message:

    Cannot create instance of 'thewinda' defined in assembly 'WpfTemplateTry, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'. Exception has been thrown by the target of an invocation. Error in markup file 'thewinda.xaml' Line 1 Position 9.

    One of its inner exceptions says: The calling thread must be STA, because many UI components require this. This is quite weird as "thewinda.xaml" is a file added to the same project as my application. I've read this error can be connected with threading/async issues, but I have no idea, how I could apply this hint to my case. This is the body of "thewinda.xaml": <Window x:Class="WpfTemplateTry.thewinda" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="Window1" Height="300" Width="300"> </Window>

    WPF wpf csharp html com design

  • Redirecting keystrokes to a RichTextBox Control in C#
    P pbalaga

    Firstly, when a key is pressed, I need to add a char to the textbox, even if it does NOT have focus. Then, when I press a key, the keydown event is obviously not detected by the textbox. The same with the form! There is no info about this event. I could use PreviewKeyDown, but I couldn't mark the message as used/handled. Secondly, the form should distribute the messages, not necessarily to the box. Maybe somewhere else, basing on other conditions.

    C# question csharp c++ javascript help

  • Redirecting keystrokes to a RichTextBox Control in C#
    P pbalaga

    I have a Form with a few panels and a RichTextBox on it. I need to detect any key messages on the level of form and send them to other child controls on my own way. I tried calling/overriding WndProc, PreProcessMessage, etc. Also tried setting my own MessageFilter via Application.AddMessageFilter() and finally gave a try to a native method SendMessage. None of these work. I CAN detect the messages. But the problem is that when I'm passing them to the RichTextBox there's no effect (no text is appended). How can I make that control react on the redirected messages? Thanks in advance.

    C# question csharp c++ javascript help

  • How to dynamically use C# 3.5 compiler
    P pbalaga

    Thanks for your answer.

    PIEBALDconsult wrote:

    CodeDom should be calling the latest installed version of the compiler.

    It should but did not. Anyway I was given a working solution on another forum.

            Dictionary<string, string> options = new Dictionary<string, string>() { { "CompilerVersion", "v3.5" } };
            Microsoft.CSharp.CSharpCodeProvider cp = new Microsoft.CSharp.CSharpCodeProvider(options);
    

    Obviously, instead of v3.5 you can specify any other supported version.

    C# csharp help tutorial question

  • How to dynamically use C# 3.5 compiler
    P pbalaga

    Well, I'd say the same until now. But I've got VC# 2008 (Express) for that, so it's rather not the case.

    C# csharp help tutorial question

  • How to dynamically use C# 3.5 compiler
    P pbalaga

    For several months I've used dynamic compiler in my app that mounted a dll on start-up. But today I came across a painful problem. The code that can be compiled trouble-free in vc#08 has syntax errors according to the 'dynamic' compiler (let me call it dynamic for distinction). The piece of code in mind looks like this:

    void foo()
    {
    //...
    ActorDescription actorDesc = new ActorDescription()
    {
    BodyDescription = new BodyDescription(70)
    };
    //...
    }

    The dynamic compiler shows an error : "error CS1002: ; expected". After simple test I managed to find out that the dynamic compiler probably aims at an older framework and I'm trying to use newer syntax features. In shortcut, what I was using is this:

          System.CodeDom.Compiler.CodeDomProvider cdp =
                System.CodeDom.Compiler.CodeDomProvider.CreateProvider("CSharp");
            System.CodeDom.Compiler.CompilerResults cr = cdp.CompileAssemblyFromFile(parameters, fullPaths);
    

    The functions above are contained by System.dll v2.0 library, so it's not surprising it won't work. Anyway, System.dll v3.5 doesn't exist. Where is the new set of methods to compile according to the newest c# specification? What's the workaround for this? I've been googling for a few hours with no answer. Thanks in advance! :)

    C# csharp help tutorial question

  • Saving image files in ARGB format (with transparency)
    P pbalaga

    Hi, is there a tool allowing to replace easily a certain color in a 24bit texture with transparent black for the use with DirectX3D 9? The image should be saved with precomputed alpha values (32bit), so that there is no need for using colorkey while loading the textures.

    Graphics question

  • DirectX programing C# (Camera rotation)
    P pbalaga

    What you mean saying the camera is "facing on some other side"? Actually, you didn't write what you want to achieve. Do you want the camera to point always the same direction? If so, you may need to recreate projection matrix, which contains the look at point of the camera. Direction vector of the camera is : dir = lookAt - position. After you store it, you can calculate new look at point from any position: newLookAt = newPosition + dir Did I help you?

    C# help csharp graphics game-dev

  • Color (Generics List) to Color[]
    P pbalaga

    And what do you want to do? Blend some colors from List<> with different colors from Color[]? To blend 2 colors at a time you don't need to split anything but rather write a loop that processes somehow each pair of colors. Then increments by 2. However, I'm confused about what you want to achieve...

    C# help

  • Difference between right and left control/shift
    P pbalaga

    Now I see what they mean with those numbers and value of 1. It is about specified bits inside lparam. No wonder that it has stranges values. You've helped me much so far, thanks. I'll post here when I come to something reasonable. Paul

    Windows Forms help tutorial question

  • Difference between right and left control/shift
    P pbalaga

    Can you let me know where did you find that information? Well, there is a difference but the value is never 1. For instance, on right alt down, there are two stages as I described. At first lparam = 1900545. Nextly, it is 557318145. Can it be dependent on the keyboard type? However you've got a point. I'll put more attention to lparam. But still, I don't know why pressing right alt causes sending two separate keydown messages. First for control, then for alt.

    Windows Forms help tutorial question

  • Loading a big file into the Tree Listview
    P pbalaga

    Speeding up the loading process depends also on the way you store data in files. Is it possible to make any precalculations for that data, so that it is not necessary to calculate some things while loading? How do you know where the items from a file should be placed in the treelistview? Try to sort data in your files, so that you know it without any parsing, calculating and so on. E.g. store a value that would indicate how many items there are to load for each branch of the tree. Secondly, you can use e.g. BackgroundWorker class provided with .NET, which will run the loading process on another thread and let you do something else, while loading lasts.

    Windows Forms data-structures tutorial
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups