readonly

Pushing read-only GUI properties back into ViewModel

I want to write a ViewModel that always knows the current state of some read-only dependency properties from the View. Specifically, my GUI contains a FlowDocumentPageViewer, which displays one page at a time from a FlowDocument. FlowDocumentPageViewer exposes two read-only dependency properties called CanGoToPreviousPage and CanGoToNex...

Read-only list of string

Is it good to use such approach for keeping read-only list of string, for example, a list of fields in ADO.NET. var list = new System.Collections.ObjectModel.ReadOnlyCollection<string>( new List<string>(4) { "type", "currency", "date", "amount" }); Or this is a superfluous solution? ...

Winforms - How to control Checkbox Colors (similar to textbox readonly)

On a checkbox I can set .Enabled = False to gray-out the checkbox rectangle and associated label. But the appearance is not visually appealing, i.e. both the label and checkmark become "faint"; (I know i can use my own label but that's only half the solution). If i set .AutoCheck = False, the colors remain normal, however user gets no c...

Make a foreign key field in a django form read-only, and still enable the form to be submitted

How do I make a foreign key field in a form read only but still allow this field to be recognized as valid once the form is submitted? According to W3C, disabled fields are left out once the form is submitted....using the code below, I can set the field as disabled, thus readonly, but my form doesn't go through def __init__(self, ...

does SQL Server 2008 supports table level readonly?

Hello everyone, Does SQL Server 2008 support table level readonly -- i.e. I can mark some table as readonly so that we could improve performance (for example, no transaction log needed for the readonly table)? thanks in advance, George ...

Declaring a const double[] in C# ?

Hello! I have several constants that I use, and my plan was to put them in a const array of doubles, however the compiler won't let me. I have tried declaring it this way: const double[] arr = {1, 2, 3, 4, 5, 6, 73, 8, 9 }; Then I settled on declaring it as static readonly: static readonly double[] arr = { 1, 2, 3, 4, 5, 6, 7, 8, 9...

How do You Create a Read-Only Dependency Property?

How do you create a read-only dependancy property? What are the best-practices for doing so? Specifically, what's stumping me the most is the fact that there's no implementation of DependencyObject.GetValue() that takes a System.Windows.DependencyPropertyKey as a parameter. System.Windows.DependencyProperty.RegisterReadOnly returns...

WPF: Use SpellCheck On Read-Only TextBox

I'm looking to display text with the wavey red lines where a word is misspelt, but I only want the text to be selectable, not editable. If I set the TextBox's IsReadOnly property to True or IsEnabled to False, the wavey red lines disappear and I can't get around it by putting something transparent as this will prevent the user being able...

C#: How should I use properties when dealing with List<T> members

When I want to make a value type read-only outside of my class I do this: public class myClassInt { private int m_i; public int i { get { return m_i; } } public myClassInt(int i) { m_i = i; } } What can I do to make a List<T> type readonly (so they can't add/remove elements to/from it) outside of my ...

EJB 3 Transaction attribute for read only method

I have a method that returns lot of data, should I use @TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED) for this method. The method perform a JPA query an loads the full content of a table (about 1000 rows). ...

Drag-and-drop modifies read-only WinForm container (plus other peculiarities of drag-and-drop)

Sampling drag-and-drop between WinForm RichTextBoxes within one application and between them and external applications revealed two interesting observations (item 1 certainly appears to be a bug; in a perfect world, item 2 would probably be as well): Some drag-and-drop operations delete the dragged text from the source container, wheth...

How do you pass parameters to Hibernate's subselect tag?

The example at the end of hibernate section 5.1.3 does not show an example on passing parameters. There is no difference between a view and a base table for a Hibernate mapping. This is transparent at the database level, although some DBMS do not support views properly, especially with updates. Sometimes you want to use ...

How to force an IIS hosted WCF or ASMX [webservice] to use session object readonly?

Hi ! While making my first ajax attempts, I decided also, to go to use IIS hosted WCF now. The strange thing is, that the WCF cannot process several requests parallel for the same user/session, if sessionmode is enabled! If sessionmode is disabled on asp.net, the requests are processed parallel. The broser/client may execute several dif...

SQL Server 2005 Shrink and Rebuild indexes

Hello, We have a weekly maintenance plan to shrink all user databases and rebuild their indexes. This has working fine until we created a read-only database, now each time the plan runs it fails when it starts processing this database due to its read only state. As far as I can see we have two options remove the read only flag from th...

Text input readonly attribute not recognized in IE7?

I am setting readonly="readonly" (in other words, true) via javascript: document.getElementById("my_id").setAttribute("readonly", "readonly"); This is having the intended effect (making the field no longer editable, but its contents are submitted with the form) in FF, Safari and Chrome, but not for IE7. In IE7 I can still modify the c...

Optional Readonly Property in VB.Net Interface

I am trying to develop a simple interface for allowing quick lists to be generated from classes. Basically, the interface needs to return an ID and a Name. However, some classes have a calculated name property which is read only, others just use a read/write name property. Basically, all I care is that it has a getter, it does not matter...

How to MakeTable ReadOnly including contents like images

I have a table which has two text boxes and a image beside it to click and open a popup. In read-only mode based on condition I am able to make text boxes read-only but images are not becoming read-only.One solution I had is the anchor tag associated with image calls for JavaScript where I can check for a dummy click when it is in read-o...

Resharper changing fields to readonly

I am trying out Resharper and i notice that it is recommending to set instance level fields to readonly. For example: private readonly IConnection _connection; public RetrieveCommand(IConnection connection) { _connection = connection; } What is the benefit of marking fields like this readonly? ...

F# : Accessing public readonly members of structs in external assemblies

I'm getting a strange error when I use F# to read a public readonly member of a struct type defined in a C# assembly. // C#: compile to Lib.dll namespace Lib { public class MyClass { public readonly int ReadonlyFoo; } public struct MyStruct { public readonly int ReadonlyFoo; public int WriteableFoo; } } ...

Do I have to write my own method to unset readony on a folder and it's contents in C#?

Hi all. I have a folder with some folders in it and some files in those folders. It so happens, that those file may be readonly which is not acceptable for me. The questions is do I have to write the code to recursively unset readonly on all files? It's not difficult to write but is there any standard .NET way to do it? My current so...