Click here to Skip to main content
15,910,009 members
Home / Discussions / WPF
   

WPF

 
GeneralRe: Custom UserControl question.... Pin
Phil Boyd26-Aug-10 10:35
Phil Boyd26-Aug-10 10:35 
QuestionWPF Display performance Pin
Eduard Keilholz25-Aug-10 23:46
Eduard Keilholz25-Aug-10 23:46 
AnswerRe: WPF Display performance Pin
Abhinav S26-Aug-10 1:06
Abhinav S26-Aug-10 1:06 
QuestionFinding SortDescriptions for a DataGrid Pin
dbrenth25-Aug-10 4:01
dbrenth25-Aug-10 4:01 
AnswerRe: Finding SortDescriptions for a DataGrid Pin
Abhinav S25-Aug-10 6:03
Abhinav S25-Aug-10 6:03 
GeneralRe: Finding SortDescriptions for a DataGrid Pin
dbrenth25-Aug-10 7:38
dbrenth25-Aug-10 7:38 
GeneralRe: Finding SortDescriptions for a DataGrid Pin
dbrenth25-Aug-10 8:03
dbrenth25-Aug-10 8:03 
Questioninterfaces and access modifiers Pin
Ed Hill _5_24-Aug-10 23:39
Ed Hill _5_24-Aug-10 23:39 
I'm looking to inherit from some standard WPF controls, including windows, buttons and a few others. I wish to add some functionality to them that will be common between several controls. My plan was to create an interface for the common functionality, and implement this interface on the required controls. The problem i am getting is that i cannot specify an access modifier on the interface implementations so that they are made available as designer editable properties.

For example i created an interface as follows:
public interface iSecurityControled
    {
        SecuritySettings.ProgramAreas ProgramArea { get; set; }
        SecuritySettings.DisabledActions DisabledAction { get; set; }
    }

    public class SecuritySettings
    {
        public enum ProgramAreas
        {
            None,
            Client,
            Development,
            Block,
            Accounts
        }
        public enum DisabledActions
        {
            None,
            Hide,
            Disable
        }
    }

I then created a class inheriting from the WPF window class and implemented the above interface
public class Form:System.Windows.Window, Interfaces.iSecurityControled
    {
        #region iSecurityControled Members
        private SecuritySettings.ProgramAreas _ProgramArea = SecuritySettings.ProgramAreas.None;
        SecuritySettings.ProgramAreas iSecurityControled.ProgramArea
        {
            get
            {
                return _ProgramArea;
            }
            set
            {
                _ProgramArea = value;
            }
        }
        private SecuritySettings.DisabledActions _DisabledAction = SecuritySettings.DisabledActions.None;
        SecuritySettings.DisabledActions iSecurityControled.DisabledAction
        {
            get
            {
                return _DisabledAction;
            }
            set
            {
                _DisabledAction = value;
            }
        }
        public int MyProperty { get; set; }
        #endregion
    }

My problem is that if i add the public modifier to the properties i get the following error message:
The modifier 'public' is not valid for this item.
I have tried to add the public modifier to the interface declaration and get the same error. This means that the property is not visible in the designer, however the MyProperty is. To sanity check my thinking i have re done this code as a standard winforms project and it works just as i want it to.
Not sure if this will be of any use but it is possible to use the following code to set the properties,
((iSecurityControled)this).DisabledAction = SecuritySettings.DisabledActions.Disable;

but this is not achieving the design time way of working that i am aiming to achieve.


If any one could point me in the direction of a solution it would be greatly appreciated.
AnswerRe: interfaces and access modifiers [modified] Pin
Pete O'Hanlon24-Aug-10 23:47
mvePete O'Hanlon24-Aug-10 23:47 
GeneralRe: interfaces and access modifiers Pin
Ed Hill _5_25-Aug-10 0:07
Ed Hill _5_25-Aug-10 0:07 
GeneralRe: interfaces and access modifiers Pin
Pete O'Hanlon25-Aug-10 1:27
mvePete O'Hanlon25-Aug-10 1:27 
QuestionCalling one button's IsMouseOver style on mouseEnter of another button Pin
Prasoon Chaudhary24-Aug-10 22:24
Prasoon Chaudhary24-Aug-10 22:24 
QuestionHow to bind the ComboBox which is in a ListView using collection Pin
DavJes24-Aug-10 4:44
DavJes24-Aug-10 4:44 
AnswerRe: How to bind the ComboBox which is in a ListView using collection Pin
Ian Shlasko24-Aug-10 5:17
Ian Shlasko24-Aug-10 5:17 
GeneralRe: How to bind the ComboBox which is in a ListView using collection Pin
DavJes25-Aug-10 5:09
DavJes25-Aug-10 5:09 
GeneralRe: How to bind the ComboBox which is in a ListView using collection Pin
Ian Shlasko25-Aug-10 5:53
Ian Shlasko25-Aug-10 5:53 
AnswerRe: How to resolve duplicated ResourceDictionary? Pin
Abhinav S24-Aug-10 5:21
Abhinav S24-Aug-10 5:21 
QuestionSerialize WPF and telerik controls [modified] Pin
michalush8523-Aug-10 20:39
michalush8523-Aug-10 20:39 
AnswerRe: Serialize WPF and telerik controls Pin
souidi abderrahman24-Aug-10 1:13
souidi abderrahman24-Aug-10 1:13 
QuestionGetting the value of Height through OneWayToSource binding Pin
la0123-Aug-10 14:50
la0123-Aug-10 14:50 
AnswerRe: Getting the value of Height through OneWayToSource binding Pin
AspDotNetDev27-Aug-10 11:14
protectorAspDotNetDev27-Aug-10 11:14 
GeneralRe: Getting the value of Height through OneWayToSource binding Pin
la0129-Aug-10 15:24
la0129-Aug-10 15:24 
QuestionHow to cache data at WPF after the application closed? Pin
michalush8522-Aug-10 4:49
michalush8522-Aug-10 4:49 
AnswerRe: How to cache data at WPF after the application closed? Pin
Pete O'Hanlon22-Aug-10 5:04
mvePete O'Hanlon22-Aug-10 5:04 
GeneralRe: How to cache data at WPF after the application closed? Pin
michalush8522-Aug-10 5:18
michalush8522-Aug-10 5:18 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.