diff options
| author | Craig Anderson <canderson@arcresources.com> | 2010-10-19 09:24:39 -0600 |
|---|---|---|
| committer | Craig Anderson <canderson@arcresources.com> | 2010-10-19 09:24:39 -0600 |
| commit | 3f87bef84da3906f525d97c1c614a402582614b1 (patch) | |
| tree | ddb00d4230576b7758de9ef4f381a1f1d77e2bce | |
| parent | 94ce21f9ce0633e742386f99f53327d68f00c993 (diff) | |
| parent | 7c0b46e50a089dffaada83a93dc005396cefe825 (diff) | |
Merge branch 'working'
| -rw-r--r-- | src/MVPtoMVVM.mvvm/MVPtoMVVM.mvvm.csproj | 3 | ||||
| -rw-r--r-- | src/MVPtoMVVM.mvvm/MainWindow.xaml | 4 | ||||
| -rw-r--r-- | src/MVPtoMVVM.mvvm/alert.png | bin | 0 -> 422 bytes | |||
| -rw-r--r-- | src/MVPtoMVVM.mvvm/viewmodels/ToDoItemViewModel.cs | 12 |
4 files changed, 17 insertions, 2 deletions
diff --git a/src/MVPtoMVVM.mvvm/MVPtoMVVM.mvvm.csproj b/src/MVPtoMVVM.mvvm/MVPtoMVVM.mvvm.csproj index bc4a913..b417efe 100644 --- a/src/MVPtoMVVM.mvvm/MVPtoMVVM.mvvm.csproj +++ b/src/MVPtoMVVM.mvvm/MVPtoMVVM.mvvm.csproj @@ -111,6 +111,9 @@ <Name>MVPtoMVVM</Name>
</ProjectReference>
</ItemGroup>
+ <ItemGroup>
+ <Resource Include="alert.png" />
+ </ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
diff --git a/src/MVPtoMVVM.mvvm/MainWindow.xaml b/src/MVPtoMVVM.mvvm/MainWindow.xaml index c148f20..fc1ec2a 100644 --- a/src/MVPtoMVVM.mvvm/MainWindow.xaml +++ b/src/MVPtoMVVM.mvvm/MainWindow.xaml @@ -4,7 +4,8 @@ Title="MainWindow" Height="350" Width="525">
<DockPanel LastChildFill="False">
<DockPanel.Resources>
- <Style x:Key="ValidationStyle" TargetType="Control">
+ <BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter"/>
+ <Style x:Key="ValidationStyle" TargetType="Control">
<Style.Triggers>
<Trigger Property="Validation.HasError" Value="true">
<Setter Property="Control.ToolTip" Value="{Binding RelativeSource={x:Static RelativeSource.Self}, Path=(Validation.Errors)[0].ErrorContent}" />
@@ -18,6 +19,7 @@ <ListView.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
+ <Image Source="alert.png" Visibility="{Binding Path=ShowDueSoonAlert, Converter={StaticResource BooleanToVisibilityConverter}, Mode=OneWay}"/>
<TextBox Width="200" Text="{Binding Path=Description, ValidatesOnDataErrors=True, UpdateSourceTrigger=PropertyChanged}" Style="{StaticResource ResourceKey=ValidationStyle}" />
<DatePicker SelectedDate="{Binding Path=DueDate, ValidatesOnDataErrors=True, UpdateSourceTrigger=PropertyChanged}" Style="{StaticResource ResourceKey=ValidationStyle}" />
<Button Content="Save" Command="{Binding Path=SaveCommand}"></Button>
diff --git a/src/MVPtoMVVM.mvvm/alert.png b/src/MVPtoMVVM.mvvm/alert.png Binary files differnew file mode 100644 index 0000000..3ac330f --- /dev/null +++ b/src/MVPtoMVVM.mvvm/alert.png diff --git a/src/MVPtoMVVM.mvvm/viewmodels/ToDoItemViewModel.cs b/src/MVPtoMVVM.mvvm/viewmodels/ToDoItemViewModel.cs index eced3da..bce0029 100644 --- a/src/MVPtoMVVM.mvvm/viewmodels/ToDoItemViewModel.cs +++ b/src/MVPtoMVVM.mvvm/viewmodels/ToDoItemViewModel.cs @@ -65,8 +65,11 @@ namespace MVPtoMVVM.mvvm.viewmodels public DateTime DueDate
{
get { return dueDate; }
- set { dueDate = value;
+ set
+ {
+ dueDate = value;
updater.Update(x => x.DueDate);
+ updater.Update(x => x.ShowDueSoonAlert);
SaveCommand.Changed();
}
}
@@ -74,6 +77,13 @@ namespace MVPtoMVVM.mvvm.viewmodels public IObservableCommand SaveCommand { get; set; }
public IObservableCommand DeleteCommand { get; set; }
public MainWindowViewModel Parent { get; set; }
+ public bool ShowDueSoonAlert
+ {
+ get
+ {
+ return DueDate <= DateTime.Today.AddDays(1);
+ }
+ }
public string this[string columnName]
{
|
