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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
C

califax2k

@califax2k
About
Posts
12
Topics
7
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Raise COM Event within C#
    C califax2k

    Hi all, I am currently trying to send a COM Event from a .NET Assembly to another application. Therefore I am applying the approach that's found multiple times across the internet. Here it's outlined for short.

    \[ComVisible(false)\]
    public delegate void OnNotifyDelegate();
    
    \[InterfaceType(ComInterfaceType.InterfaceIsIDispatch)\]
    public interface Events
    {
        void OnNotify();
    }
    
    \[Guid(EventSource.ClsID)\]
    \[ClassInterface(ClassInterfaceType.None)\]
    \[ComSourceInterfaces(typeof(Events))\]
    public class EventSource : ServicedComponent, EventInterface
    {
        private const string ClsID = "4A235195-E8B3-473b-8F14-F7F0ADFC40E0";
        
        public event OnNotifyDelegate OnNotify;
    
        public EventSource() { }
    
        public void CauseOnNotify()
        {
            OnNotify();
        }
    }
    

    Now, to raise the OnNotify Event I created a small WPF Application with a button, whose Click handler invokes the method CauseOnNotify above. I don't show it here, because that would be verbose. What I get is a NullPointerException because OnNotify is at the time it's invoked null. My question is: None of the examples mentions a instanciation of the delegate (which is why its null, but under which circumstances does this exception not happen? Where is the instance coming from? thanks in advance Lars

    #pragma error( disable : * )

    C# csharp question wpf com help

  • Function Call Mechanism
    C califax2k

    Hi all, I am looking for a library which can perform the following tasks: - Taks a description of a method call (e.g. Method name, Parameter name and parameter Value) - Parse the method description - invoke a method depending on the parsed description. - encode the result of the method invocation and pass it as text back. I know that all of this isn't rocket science, the question is: Is there a library that I can use. best regards Lars

    #pragma error( disable : * )

    C# help question

  • Access resource from another resource
    C califax2k

    Hi, I am trying to do the following:

    <UserControl.Resources>
    <Color x:Key="ColorPurple" R="0x9F" G="0x15" B="0xC3"/>
    <DataTemplate x:Key="PredicatTemplatePurple">
    <TextBlock Name="predicatTemplateName">
    <TextBlock.Background>
    <SolidColorBrush Color="{StaticResource ColorPurple}" />
    </TextBlock.Background/>
    </TextBlock/>
    </DataTemplate/>
    <UserControl.Resources/>

    Unfortunately the color is not used by the template. Is there a way for achieving this effect? It's important for me to use my oww color definitions. Thanks in advance Lars

    #pragma error( disable : * )

    WCF and WF help question learning

  • Parametrize WPF code generator
    C califax2k

    Hi all, I am in the following situation: I am writing my own "application framework" *WOW* - just for myself, nothing generally interesting ;) There I want to implement a base class for applications - lets call it AppBase which is derived from System.Windows.Application. A concrete WPF application is to use AppBase as base class for the partial class MyApp.App in the file App.XAML.cs. Now when compiling a concrete WPF application a code generator transforms the XAML code of MyApp.App into c# and puts System.Windows.Application as base class for the generated part in App.g.cs. This leads to the situation that the compiler complains that I am not to use different base classes for my partial class MyApp.App. What I am wondering is: Is there a way to tell the code generator which base class to use?? Any other way to enable the specification of custom base classes for WPF applications is also wellcome. Thanks in advance. Lars

    #pragma error( disable : * )

    WPF csharp wpf help question

  • Databinding for editable tree view
    C califax2k

    You're so cool, Thanks a lot ;-)

    #pragma error( disable : * )

    WCF and WF wpf wcf data-structures help

  • Databinding for editable tree view
    C califax2k

    Further investigation: also setting the data context of the treeview to make the bindings refer implicitly to this data context didn't help :confused:

    #pragma error( disable : * )

    WCF and WF wpf wcf data-structures help

  • Databinding for editable tree view
    C califax2k

    Hi, my problem is the following: I am binding a data structure to a tree view and I want to edit elements of this data structure. But when a TreeViewItem has been selected the TextBox doesn't contain the Name (that's the part of the data element that is to be changed) but its empty. The data elements look like this:

    public class PiList
        : INotifyPropertyChanged
    {
    
        private string m\_name;
        // This is the one that is to be changed.
        public string Name
        {
            get
            {
                return m\_name;
            }
            set
            {
                m\_name = value;
                OnPropertyChanged("Name");
            }
        }
    
        private readonly ObservableCollection \_children = new ObservableCollection();
        public ObservableCollection Children
        {
            get
            {
                return \_children;
            }
        }
    
        public event PropertyChangedEventHandler PropertyChanged;
        void OnPropertyChanged(string name)
        {
            if (PropertyChanged != null)
            {
                PropertyChanged(this, new PropertyChangedEventArgs(name));
            }
        }
    }
    

    For this data structure I have the following data template:

    <HierarchicalDataTemplate DataType="{x:Type local:PiList}" ItemsSource="{Binding Path=Children}">
    <ContentControl Content="{Binding Name}" Style="{StaticResource EditableContentControl}"/>
    </HierarchicalDataTemplate>

    This template applies the style EditableContentControl to the ContentControl. This style is defined like this:

    <Style x:Key="EditableContentControl" TargetType="{x:Type ContentControl}">

    <Setter Property="ContentTemplate">
        <Setter.Value>
            <DataTemplate DataType="{x:Type local:PiList}">
                <TextBlock Text="{Binding Path=Name}" />
            </DataTemplate>
        </Setter.Value>
    </Setter>
    
    <Style.Triggers>
        <DataTrigger Binding="{Binding Path=IsSelected,RelativeSource={RelativeSource AncestorType={x:Type TreeViewItem}}}"
                     Value="True">
            <Setter Property="ContentTemplate">
                <Setter.Value>
                    <DataTemplate DataType="{x:Type local:PiLis
    
    WCF and WF wpf wcf data-structures help

  • convert byte[] to BitmabImage
    C califax2k

    Hi, I think, in my case its different ;) I am receiving an image from a webcam. What I want to do is, The image data is provided through an Image which uses a FormatConvertedBitmap as ImageSource. This bitmap uses a TransformedBitmap as BitmapSource (this all looks a bit like a decorator pattern). Now I do the following: I call CopyPixels on the TransformedBitmap with an pre allocated buffer with size: source.PixelWidth * source.PixelHeight * source.Format.BitsPerPixel / 8. The stride is source.PixelWidth * bytesPerPixel and the offset is 0. I pass this buffer as an argument to a memory stream and try to use this stream as StreamSource for a BitmapImage. It produces exactly the error message mentioned above ;( I played with CachingOptions (set it to None), CreationOptions (PreservePixelFormat) -> nothing ;-( Any Ideas? Greetz, Lars

    #pragma error( disable : * )

    WPF help question

  • Overlay usercontrolss
    C califax2k

    Hi, is there a way to render one user control directly over another one so that it is still able to receive mouse events - comparable with a context menu. thanks in advandce Lars

    #pragma error( disable : * )

    WCF and WF help

  • convert byte[] to BitmabImage
    C califax2k

    I am also interested in which members this might be. Which are the most important ones? Thanks, Lars

    #pragma error( disable : * )

    WPF help question

  • Create pixel dimensions of a text string
    C califax2k

    thanks for your reply. I forgot to mention that I want to limit myself to the WPF API. Nevermind, your answer helped me figure out the WPF-way of doing it. I am using now an instance of FormattedText und ask its Width and Height properties. Interestingly there exists a method GetMaxLineWidths() in this class but it doesn't work as I expected. It always returns {null}. Regards, Lars

    #pragma error( disable : * )

    WPF help question

  • Create pixel dimensions of a text string
    C califax2k

    Hi, I have the following problem: I want to know the width and height in pixels of a text string of a certain length. I tried using TextBox.GetRectFromCharacterIndex() but this didn't work. I suspect the reason is that the textBox has not been drawn before I invoked this method. I just assigned the Text property a value. The resulting rectangle is {empty}. Is there a way to obtain the pixel dimensions of a string without haven drawn or shown it. I certainly know that the result also depends on the text formating. Nevertheless, is there a way to obtain this information? thanks in advance Lars

    #pragma error( disable : * )

    WPF help question
  • Login

  • Don't have an account? Register

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