I have a UserControl with some custom dependency properties bound to a clr property in the ViewModel. The ViewModel has application logic where I deal with the TextPointer/TextRange classes with a FlowDocument.
Should I put that stuff into the code-behind of the UserControl or in the ViewModel?
ranges.Clear();
TextRange ran...
I've simplified the code below down to a basic example, but I still cannot get the value to set. When performing the propertyInfo.SetValue(), it will hit a breakpoint on the setter of my Contact object and the value is set correctly in the 'setter.' However, after the SetValue() has executed, the string properties on my projectContact....
I'm enhancing an open source control to add some functionality that I need, and I'm getting hopelessly tangled up in the following problem:
The control is a rich textbox that supports HTML but not via a property; you have to do something like this:
var sHtml = "..."
ctrl.LoadHtml(sHtml)
and
var sHtml = ctrl.SaveHtml()
So far so go...
Hey guys,
We have an object that is assigned to a PropertyGrid using the SelectedObject property of the PropertyGrid. This object contains a few properties which get updated by code in various places. For the purpose of this example, assume one is a simple update (ie: caused by the following code - Person.FirstName = "Gareth"), and that...
When iterating over an object's properties, is it safe to delete them while in a for-in loop?
For example:
for (var key in obj) {
if (!obj.hasOwnProperty(key)) continue;
if (shouldDelete(obj[key])) {
delete obj[key];
}
}
In many other languages iterating over an array or dictionary and deleting inside that is uns...
I have searched many questions on ObjC accessors and synthesized accessors to no avail. This question is more of a "help me settle an issue" question; I don't expect one answer, but I'm rather looking for experts to weigh in on the argument.
In a Cocoa Touch class, I would write some code like this (where soundEffects is a synthesized ...
I want to do this:
interface IBase
{
string Property1 { get; }
}
interface IInherited : IBase
{
string Property1 { get; set; }
}
So that IInherited would have the inherited property Property1 with added functionality to allow set.
Is that possible? What's the syntax?
EDIT: please notice I put the word "inherited" in bold fa...
Hello all.
I have the following generic .net code to change the background colour of a label. Lovely.
<asp:UpdatePanelAnimationExtender ID="UpdatePanel1_UpdatePanelAnimationExtender"
runat="server" Enabled="True" TargetControlID="UpdatePanel1">
<Animations>
<OnUpdating>
<Color
AnimationTarge...
I want to make a C# Dictionary in which the key is the string name of a static property in a class and the value is the value of the property. Given a static property in the class called MyResources.TOKEN_ONE, how can I get the at the name of the property rather than its value? I only care about the end part of the property name (e.g. ...
Hello, I have the following Field:
private IList<Modulo> modulos;
and the following Property:
public virtual ArrayList XmlModulos
{
get
{
if (modulos == null) return new ArrayList();
var aux = new ArrayList();
foreach (Modulo m in modulos)
aux.Add(m);
...
I've created some custom property for my web part with Personalizable(PersonalizationScope.User) attribute. I changing this property in EditorPartClass in ApplyChanges() Method only. The main problem is user with contribute permission for a site can't save this property when editing personalized view of a page. Changing property applies ...
Hi,
I am trying to make a 2-way binding of a class property.
public class MyClass{
public MyField AField1{get;set;};
public MyField AField2{get;set;};
}
public class MyField{
public string Value {get; set}
}
MyClass _class = MyClass();
_dv.DataSource = _class;
Databinding text object displays MyField class name instead of Value Prop...
When I create entities in a class library, I tend to add a Tag property which may be used by users and extending libraries to store arbitrary data with the object. Now I am looking for the best way to implement such a Tag property in my class library, and the reasons why.
In System.Windows.Forms, Microsoft uses object Tag { get; set; } ...
The first part of the problem is that I don't know if there's a specific name for a system like this :)
In my app I need a system to give the user the ability to interconnect object-properties;
objects can have inputs and outputs, and inputs of one object can be connected to outputs of other objects.
Optionally type-converters can be us...
I've started learning Objective-C a few weeks ago and I still don't understand how to manage the encapsulation of a class correctly. What is the best way to declare a private member variable in a class?
It seems that setting the right getter/setter for your member variable with "@property" is the right way to go, more than just declarin...
Hi,
I installed the MediaWiki-extension Semantic MediaWiki recently. In this extension you can define properties. They are like categories for values. If I define two properties like this:
[[StartYear::2000]] [[EndYear::2005]]
Is it possible to make calculations based on these properties if I do a semantic search. For example:
{{#a...
So you can arrange items to be in the back or front, is there a way to set it to always be Front?
...
I want to create a generalized helper method for LoadFromXML loading and validation. If the XML I'm loading from is incomplete, I do want it to fail completely without throwing an exception. Currently, my code looks like this (more or less)
public override bool Load(XElement source)
{
return new List<Func<XElement, bool>>
{
...
I'm using C#, with which I don't have a lot of experience (I've mostly worked with java/php/javascript so far)
What I want is a class in which I save some data, this data can only be written by one other class, but still be read by other classes in the program.
Something like this:
public class DataObtainer{
DataItem[] Items;
public...
I use a GroupBox and its text property is supposed to be "Word1 & Word2". But it seems the UseMnemonic feature takes effective that the result looks like "Word _Word2".
So how can I disable UseMnemonic feature of a GroupBox? Or any workaround.
(I know there is property UseMnemonic for a Button control, but I cannot find the correspond...