Hope this helps You could create a class DateFormatChoice that contains a property for the format code (e.g., "m" or "D") and a property for the current date formatted in that way.
public class DateFormatChoice {
public string FormatCode { get; private set; }
public string CurrentDateExample {
get { return DateTime.Now.ToString( FormatCode ) }
}
public DateFormatChoice( string standardcode ) {
FormatCode = standardcode;
}
}
public class DateFormatChoices : List<DateFormatChoice> {
public DateFormatChoices() {
this.Add( new DateFormatChoice( "m" ) );
this.Add( new DateFormatChoice( "d" ) );
this.Add( new DateFormatChoice( "D" ) );
}
}
public class ViewModel : INotifyPropertyChanged {
public event PropertyChangedEventHandler PropertyChanged = ( s, e ) => {
}; // the lambda ensures PropertyChanged is never null
public DateFormatChoices Choices {
get;
private set;
}
DateFormatChoice _chosen;
public DateFormatChoice Chosen {
get {
return _chosen;
}
set {
_chosen = value;
Notify( PropertyChanged, () => Chosen );
}
}
public DateTime CurrentDateTime {
get {
return DateTime.Now;
}
}
public ViewModel() {
Choices = new DateFormatChoices();
}
// expression used to avoid string literals
private void Notify<T>( PropertyChangedEventHandler handler, Expression<Func<T>> expression ) {
var memberexpression = expression.Body as MemberExpression;
handler( this, new PropertyChangedEventArgs( memberexpression.Member.Name ) );
}
}
<Grid>
<TextBlock Name="datedisplayer" />
</Grid>
private static void DateFormatChanged( DependencyObject obj, DependencyPropertyChangedEventArgs e ) {
var uc = obj as UserControl1;
string code;
if ( null != ( code = e.NewValue as string ) ) {
uc.datedisplayer.Text = DateTime.Now.ToString( code );
}
}
I hope this helps . 1) When updating data, use a PUT request. That's the basic RESTful style of Rails (GET → show, POST → create, PUT → update, DELETE → destroy). So basically, the action to call is LocationsController#update (judging by the code you posted). No need for a new action 2) Put the entire update path in a data- attribute on the element. I'm assuming you mean "dropdown" when you say "combobox", in which case it'd be something like
Activate text box when the user selects a value in a combobox
will help you When a user ONLY selects Male from the following combobox, i want to display a textfield below. This should only happen when the user selects the value Male. , try this
I wish did fix the issue. What event is triggered when user selects value from drop down ComboBox (Active X). How it can be defined in VBA. I would like to trigger macro when value is selected from drop down. , ComboBox_Click() is the event you are looking for.
How set combobox value when user selects a value in another combobox
it fixes the issue Your problem is that you try to instantiate the calibreList again by doing calibrelist = FXCollections.observableList(cal);. If calibreList is the list that contains the items of the ComboBox, which has been added to the ComboBox by doing caliberComboBox.setItems(calibreList);, then you need to manipulate that original list instead of instantiating it again. So instead of calibrelist = FXCollections.observableList(cal);, do calibrelist.add(a.getCalibre);