Search Results

Search found 4 results on 1 pages for 'orloffm'.

Page 1/1 | 1 

  • How to add custom-control-derived TabItem to TabControl in WPF?

    - by orloffm
    I want to have my own base TabItem class and use other classes that derive from it. I define base class in MyNs namespace like this: public class MyCustomTab : TabItem { static MyCustomTab() { DefaultStyleKeyProperty.OverrideMetadata(typeof(MyCustomTab), new FrameworkPropertyMetadata(typeof(TabItem))); } } And this is what I do for the class that inherits from it: code-behind in MyNs namespace: public partial class ActualTab : MyCustomTab { public ActualTab() { InitializeComponent(); } } XAML: <MyCustomTab x:Class="MyNs.ActualTab" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> <Grid> </Grid> </MyCustomTab> The error I get is "The tag 'MyCustomTab' does not exist in XML namespace 'http://schemas.microsoft.com/winfx/2006/xaml/presentation'". If I use TabItem tag in XAML the error says that it's not possible to define to different base classes. How to fix this?

    Read the article

  • Weird behaviour of a deserialized class

    - by orloffm
    I've got a huge XML file that's being deserialized by XmlSerializer in an XSD-generated class structure. Everything used to work just fine, but now a weird thing started happening. Sometimes (50% of runs) a field of a certain object of a class that's deep in the class tree just changes to a certain value of the same field of a different object of the same class. It happens when entering some function, when debugger steps from opening "{" to the first line of code. I understand that it's stupid question, but maybe someone have any thoughts?

    Read the article

  • How to make += operator keep the object reference?

    - by orloffm
    Say, I have a class: class M { public int val; And also a + operator inside it: public static M operator +(M a, M b) { M c = new M(); c.val = a.val + b.val; return c; } } And I've got a List of the objects of the class: List<M> ms = new List(); M obj = new M(); obj.val = 5; ms.Add(obj); Some other object: M addie = new M(); addie.val = 3; I can do this: ms[0] += addie; and it surely works as I expect - the value in the list is changed. But if I want to do M fromList = ms[0]; fromList += addie; it doesn't change the value in ms for obvious reasons. But intuitively I expect ms[0] to also change after that. Really, I pick the object from the list and then I increase it's value with some other object. So, since I held a reference to ms[0] in fromList before addition, I want still to hold it in fromList after performing it. Are there any ways to achieve that?

    Read the article

1