Skip to content

Commit

Permalink
update NoteListControl layout
Browse files Browse the repository at this point in the history
  • Loading branch information
durow committed Oct 26, 2015
1 parent 4b20013 commit c83b855
Show file tree
Hide file tree
Showing 6 changed files with 59 additions and 22 deletions.
1 change: 0 additions & 1 deletion MVVMTest/EventBindingTest/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
xmlns:cmd="clr-namespace:MyMVVM;assembly=MyMVVM"
xmlns:local="clr-namespace:EventBindingTest"
mc:Ignorable="d" WindowStartupLocation="CenterScreen"
Title="MainWindow" Height="350" Width="525">
<i:Interaction.Triggers>
Expand Down
2 changes: 0 additions & 2 deletions MVVMTest/EventBindingTest/MainWindowViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ class MainWindowViewModel : NotifyObject
{

private bool _IsReceiveMouseMove = true;

public bool IsReceiveMouseMove
{
get { return _IsReceiveMouseMove; }
Expand All @@ -24,7 +23,6 @@ public bool IsReceiveMouseMove
}

private string _tipText;

public string TipText
{
get { return _tipText; }
Expand Down
7 changes: 1 addition & 6 deletions MVVMTest/MyMVVM/MyEventCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,9 @@ protected override void Invoke(object parameter)
{
if (CommandParateter != null)
parameter = CommandParateter;
var cmd = GetCommand();
var cmd = Command;
if (cmd != null)
cmd.Execute(parameter);
}

private ICommand GetCommand()
{
return Command;
}
}
}
1 change: 0 additions & 1 deletion UWPDDD/Domain/Model/ACategory.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@


namespace Domain.Model
{
public sealed class ACategory
Expand Down
28 changes: 16 additions & 12 deletions UWPDDD/UWPDDD/View/NoteListControl.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,32 +10,34 @@
<UserControl.DataContext>
<vm:NoteListViewModel x:Name="VM"/>
</UserControl.DataContext>
<Grid Padding="5">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Grid Background="LightGray" Padding="5" Grid.Row="0">
<Grid Background="LightGray" Grid.Row="0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<Button Content="设置" />
<Button Content="新建" Grid.Column="2"/>
<Button Content="菜单" Height="40" Background="Transparent"/>
<Button Content="新建" Height="40" Grid.Column="2" Background="Transparent"/>
<TextBlock Text="A-NoteBook" Grid.Column="1" VerticalAlignment="Center" FontFamily="微软雅黑" FontSize="24" FontWeight="Bold" TextAlignment="Center"/>
</Grid>
<AutoSuggestBox Grid.Row="1" Margin="10" PlaceholderText="搜索标题" QueryIcon="Zoom"/>
<ListView Grid.Row="2" ItemsSource="{Binding NoteList}">
<AutoSuggestBox Grid.Row="1" Margin="20,7,20,5" Background="Transparent"
PlaceholderText="搜索标题" QueryIcon="Zoom" />
<ListView Grid.Row="2" Padding="5,0,5,0"
ItemsSource="{Binding NoteList}">
<ListView.ItemContainerStyle>
<Style TargetType="ListViewItem">
<Setter Property="HorizontalContentAlignment" Value="Stretch"/>
</Style>
</ListView.ItemContainerStyle>
<ListView.ItemTemplate>
<DataTemplate>
<Grid Margin="0,5,0,0" BorderBrush="LightGray" BorderThickness="1" CornerRadius="4">
<Grid Margin="0,2,0,2" BorderBrush="LightGray" BorderThickness="2" CornerRadius="5" Background="#FFF0ECEC">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
Expand All @@ -45,13 +47,15 @@
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<TextBlock VerticalAlignment="Center" Text="{Binding AddDateTime}" Margin="2"/>
<TextBlock Grid.Row="0" Grid.Column="2"
<TextBlock VerticalAlignment="Center" Text="{Binding AddDateTime}"
FontSize="12" Margin="10,5,10,0"/>
<TextBlock Grid.Row="0" Grid.Column="2" Margin="10,5,10,0"
VerticalAlignment="Center" TextAlignment="Right"
Text="{Binding Category.Category}"/>
<Border Grid.Row="1" Grid.ColumnSpan="3" BorderBrush="LightGray" BorderThickness="0,1,0,0">
FontSize="12" Text="{Binding Category.Category}"/>
<Border Grid.Row="1" Grid.ColumnSpan="3" Margin="5,2,5,5"
BorderBrush="LightGray" BorderThickness="0,1,0,0">
<TextBlock Text="{Binding Title}" VerticalAlignment="Center"
FontFamily="微软雅黑" FontSize="18" Margin="8"/>
FontFamily="微软雅黑" FontSize="16" Margin="5,10,5,10"/>
</Border>
</Grid>
</DataTemplate>
Expand Down
42 changes: 42 additions & 0 deletions UWPDDD/ViewModel/NoteListViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,48 @@ public NoteListViewModel()
{
NoteList = new ObservableCollection<ANote>
{
new ANote
{
AddDateTime = DateTime.Now.ToString(),
EditDateTime = DateTime.Now.ToString(),
Title = "测试数据,标题一定要长才行!!",
Category = new ACategory {Category="默认分组" }
},
new ANote
{
AddDateTime = DateTime.Now.ToString(),
EditDateTime = DateTime.Now.ToString(),
Title = "This is test data!",
Category = new ACategory {Category="我的笔记" }
},
new ANote
{
AddDateTime = DateTime.Now.ToString(),
EditDateTime = DateTime.Now.ToString(),
Title = "测试数据,标题一定要长才行!!",
Category = new ACategory {Category="默认分组" }
},
new ANote
{
AddDateTime = DateTime.Now.ToString(),
EditDateTime = DateTime.Now.ToString(),
Title = "This is test data!",
Category = new ACategory {Category="我的笔记" }
},
new ANote
{
AddDateTime = DateTime.Now.ToString(),
EditDateTime = DateTime.Now.ToString(),
Title = "测试数据,标题一定要长才行!!",
Category = new ACategory {Category="默认分组" }
},
new ANote
{
AddDateTime = DateTime.Now.ToString(),
EditDateTime = DateTime.Now.ToString(),
Title = "This is test data!",
Category = new ACategory {Category="我的笔记" }
},
new ANote
{
AddDateTime = DateTime.Now.ToString(),
Expand Down

0 comments on commit c83b855

Please sign in to comment.