-
Notifications
You must be signed in to change notification settings - Fork 0
Snippets
Sevenate edited this page Oct 24, 2018
·
6 revisions
In XAML view:
<ListBox x:Name="DateRangeList"
Controls:DockPanel.Dock="Left"
ItemsSource="{Binding Path=Intervals}"
SelectedValue="{Binding Path=SelectedDateRange, Mode=TwoWay}"
SelectedValuePath="Value" />
and in C# view-model:
public enum DateRange
{
[Description("Day")]
Day = 1,
[Description("4 Days")]
FourDays = 4,
[Description("Week")]
Week = 7,
[Description("Month")]
Month = -1, // "30" could confuse, cause why not "31" or "28"?
}
public EnumWrapperList<DateRange> Intervals { get; private set; }
//...
Intervals = new EnumWrapperList<DateRange>();
//...
public DateRange SelectedDateRange
{
get { return selectedDateRange; }
set
{
selectedDateRange = value;
NotifyOfPropertyChange(() => SelectedDateRange);
}
}
In XAML view:
<ListBox x:Name="Items"
HorizontalContentAlignment="Stretch">
</ListBox>
<ContentControl Grid.Column="1"
cal:View.Model="{Binding Path=ActiveItem.DetailsVM}"
VerticalContentAlignment="Stretch"
HorizontalContentAlignment="Stretch">