I have an existing property in episerver that is now changed to a content area.This is basically for storing image that the content area will be used with just 1content item. I'll be adding a validation check for 1item of image of type .png for instance.
Now because this is an existing property with a different type,i need to create a schedule job to set the value.
So the question is Can we set content area property with a schedule job?
Any input is appreciated.
You can create a ContentAreaItem instance with its ContentLink property set to an IContent instance of type ImageData to programmatically add an image to the Items property of a ContentArea.
Related
I am new to VB and programming in general, however, I am currently trying to develop a simple application where you can add and save daily records to a database. One of the columns in the database table will be used to input paths/directories to files in my computer (e.g. C:\Users\M\Documents). When I type in the the file location and run the application the column contents is viewed as text and not a hyperlink. Could someone explain how to convert text in a specified column to hyperlinks (clickable)?
Thank you
There is a column type DataGridViewLinkColumn, but you cannot edit the cells content at runtime in DataGridView (only from source code).
Another solution:
Use DataGridViewTextBoxColumn column type.
To link style: You can use the cell DefaultCellStyle property to make blue text.
To mouse icon: You can handle the DataGridView's CellMouseEnter event to change the DataGridView.Cursor property when the mouse is over the link column.
With the DataGridView's CellClick or CellContentClick event you can handle the click on link.
I am working in C# and Silverlight 5, and I am trying to display one or more audio and/or video files that have been retrieved from a database table as a byte array. I decided the best way to get those byte arrays into a usable format was to create an ObservableCollection list in my ViewModel that gets populated during the service call:
mediaFiles = new ObservableCollection<MediaElement>();
foreach (FileUpload fu in FileUploadMediaTable)
{
using (MemoryStream ms = new MemoryStream(fu.bytes, 0, fu.bytes.Length))
{
MediaElement me = new MediaElement();
me.SetSource(ms);
mediaFiles.Add(me);
}
}
Now, my only problem is figuring out how to add these media elements into the view. I was thinking of creating a new ItemsControl with a custom DataTemplate that defines the buttons for playback that embeds the MediaElements in a StackPanel, but how would I associate each of the buttons with that specific MediaElement?
EDIT: Of course, I guess I could just create a list of byte arrays and add a MediaElement object to the DataTemplate and pass the byte array in the source with a Bytes2ImageConverter defined. Of course, maybe I could skip that step and just bind the MediaElement's source to a MemoryStream object created on each byte array. I am not sure of the best way to proceed (or if this stuff is even possible).
You can create a Model class, which will contain Media source (will be bound to the MediaElement Source property) and addition data, which needed (caption, author, etc). You can use a list box for displaying all these videos. You should create an item template and use it for listbox items. This item template will contain a media element and a play/stop button, where you will bind a command. Command will be placed in your ViewModel class and you can bind a Model as command parameter. So, you can get access to medial source (Model class), which should be played. What about playing/stopping video: you can create a media element helper, which will contain an attached dependency property (for example: IsPlaying, in your model class). You will bind a true/false value for playing/stopping the video. Thats all.
I want to save form position. I have successfully set Form.Location property in ApplicationSettings->PropertyBinding but Form.Size is not listed in property binding list. Why? Do I need to add this property to save properties list using code?
The Form class overrides the Size property to prevent it from getting saved. This is by design, it uses the ClientSize instead so that the size doesn't depend on the border width chosen by the user. You'll find ClientSize in the property binding list.
This is still not a good idea, you don't want to save the size if the window is minimized or maximized. It will not restore properly. Instead, override the OnResizeEnd() method and only save the size if the WindowState is Normal.
I have a childwindow with a number of Textboxes, Comboboxes, and DatePickers. I want to know if a user has changed any value in these (to know if I need to save to db)
One way I could think of doing this are in the 'on chg' event handlers and set bool. But if a user changes the value, in say a combobox, then changes back to the original this would still be seen as a change.
Are there other alternatives?
(note the project is not set up as MVVM)
If you don't use mvvm but still bind to an object then:
before the window is shown create a copy of the object, save it, and bind it to DataContext
whenever you need to know if user made any changes you can compare the saved object to DataContext (property by property)
I you don't use binding at all then:
before the window is shown save all fields that can be modified to a Dictionary
whenever you need to know if user made any changes you can compare the dictionary values to values of the fields
I have a tab that has its content set to an object (a TFS WorkItem). I have a DataTemplate for the WorkItem type.
When I set the object to the tab it displays nicely.
However, when I update one of the collections on the object (the list of links) this change is not refreshed to the view.
I have tried making my WorkItem a DependencyProperty and I have also tried setting the value of the tab's content to null then to my object again (in the hopes that it will reload it).
None of this works.
Normally I would just use an observable collection to store the links in, but as I do not own the WorkItem class, I need a different solution that will manually refresh the DataTemplate.
Any ideas?
To force a binding to refresh the UI, call BindingExpression.UpdateTarget. To get the binding expression for a given element (in your case I assume an ItemsSource), use BindingOperations.GetBindingExpression. E.g.
BindingExpression bindingExpr = BindingOperations.GetBindingExpression(linksListBox, ListBox.ItemsSourceProperty);
bindingExpr.UpdateTarget(); // refreshes the ItemsSource
However, this relies on having a reference to the control whose property is bound, which may be difficult if the control is in a DataTemplate. You could try performing an UpdateTarget() on whichever control is hosting the DataTemplate (the Tab?) and whichever property is bound to the WorkItem (the Content property?) but I haven't tested this. (I'd be interested to know if it works!)