|
5 | 5 | xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
6 | 6 | xmlns:dd="clr-namespace:PackageManager.Views.DesignData"
|
7 | 7 | xmlns:controls="clr-namespace:PackageManager.Views.Controls"
|
| 8 | + xmlns:views="clr-namespace:PackageManager.Views" |
8 | 9 | mc:Ignorable="d" d:DesignHeight="450" d:DesignWidth="800" d:DataContext="{Binding Source={x:Static dd:ViewModelLocator.Browser}}" Background="White">
|
9 | 10 | <DockPanel x:Name="MainPanel">
|
10 | 11 | <StackPanel Margin="8" DockPanel.Dock="Top">
|
|
41 | 42 | <RowDefinition Height="Auto" />
|
42 | 43 | </Grid.RowDefinitions>
|
43 | 44 |
|
44 |
| - <ListView x:Name="lvwPackages" ItemsSource="{Binding Packages}" SelectionChanged="lvwPackages_SelectionChanged" BorderThickness="0" ScrollViewer.HorizontalScrollBarVisibility="Disabled"> |
| 45 | + <ListView x:Name="lvwPackages" SelectedItem="{Binding SelectedPackage, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=views:Browser}}" ItemsSource="{Binding Packages}" SelectionChanged="lvwPackages_SelectionChanged" BorderThickness="0" ScrollViewer.HorizontalScrollBarVisibility="Disabled"> |
45 | 46 | <ListView.ItemTemplate>
|
46 | 47 | <DataTemplate>
|
47 | 48 | <Border Padding="8">
|
|
78 | 79 | </Border>
|
79 | 80 |
|
80 | 81 | <Border BorderThickness="1" BorderBrush="{StaticResource BorderBrush}" Margin="4,4,8,8" Grid.Column="1">
|
81 |
| - <ScrollViewer HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto"> |
82 |
| - <StackPanel Margin="8" DataContext="{Binding SelectedItem, ElementName=lvwPackages}" d:DataContext="{Binding Source={x:Static dd:ViewModelLocator.PackageViewModel}}" Visibility="{Binding Converter={StaticResource NullToCollapsedConverter}}"> |
83 |
| - <StackPanel Orientation="Horizontal"> |
84 |
| - <StackPanel.DataContext> |
| 82 | + <DockPanel Margin="8"> |
| 83 | + <views:PackageName DockPanel.Dock="Top"> |
| 84 | + <views:PackageName.Model> |
| 85 | + <MultiBinding Converter="{StaticResource FirstNotNullMultiConverter}"> |
| 86 | + <Binding Path="SelectedVersion.Model" RelativeSource="{RelativeSource Mode=FindAncestor, AncestorType=views:Browser}" /> |
| 87 | + <Binding Path="SelectedPackage.Model" RelativeSource="{RelativeSource Mode=FindAncestor, AncestorType=views:Browser}" /> |
| 88 | + </MultiBinding> |
| 89 | + </views:PackageName.Model> |
| 90 | + </views:PackageName> |
| 91 | + <StackPanel DataContext="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=views:Browser}}" Margin="0,8" Orientation="Horizontal" HorizontalAlignment="Left" DockPanel.Dock="Top"> |
| 92 | + <Button Content="Install" Command="{Binding ViewModel.Install}" Margin="0,0,8,0"> |
| 93 | + <Button.CommandParameter> |
85 | 94 | <MultiBinding Converter="{StaticResource FirstNotNullMultiConverter}">
|
86 |
| - <Binding Path="SelectedItem" ElementName="cbxVersions" /> |
87 |
| - <Binding /> |
| 95 | + <Binding Path="SelectedVersion.Model" /> |
| 96 | + <Binding Path="SelectedPackage.Model" /> |
88 | 97 | </MultiBinding>
|
89 |
| - </StackPanel.DataContext> |
90 |
| - |
91 |
| - <Image Source="{Binding IconUrl, Converter={StaticResource NullToDefaultIconConverter}}" Width="33" Height="34" Margin="0,4,8,0" VerticalAlignment="Top" DockPanel.Dock="Left" /> |
92 |
| - <TextBox Text="{Binding Id, Mode=OneWay}" Style="{StaticResource ReadOnlyTextBoxStyle}" FontSize="20" VerticalAlignment="Center" /> |
93 |
| - </StackPanel> |
94 |
| - |
95 |
| - <Grid Margin="0,8"> |
96 |
| - <StackPanel Orientation="Horizontal" HorizontalAlignment="Left"> |
97 |
| - <Button Content="Install" Command="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=Border}, Path=DataContext.Install}" Margin="0,0,8,0"> |
98 |
| - <Button.CommandParameter> |
99 |
| - <MultiBinding Converter="{StaticResource FirstNotNullMultiConverter}"> |
100 |
| - <Binding Path="SelectedItem.Model" ElementName="cbxVersions" /> |
101 |
| - <Binding Path="Model" /> |
102 |
| - </MultiBinding> |
103 |
| - </Button.CommandParameter> |
104 |
| - </Button> |
105 |
| - |
106 |
| - <Button Content="Other versions.." Command="{Binding LoadVersions}" Visibility="{Binding AreVersionsLoaded, Converter={StaticResource FalseToVisibleConverter}}" MinWidth="100" MaxWidth="100" /> |
107 |
| - <ComboBox x:Name="cbxVersions" ItemsSource="{Binding Versions}" SelectedItem="{Binding Mode=OneWay}" DisplayMemberPath="Version" ItemStringFormat="{}v{0}" |
108 |
| - SelectionChanged="cbxVersions_SelectionChanged" |
109 |
| - Visibility="{Binding AreVersionsLoaded, Converter={StaticResource TrueToVisibleConverter}}" MinWidth="100" MaxWidth="100" /> |
110 |
| - </StackPanel> |
111 |
| - </Grid> |
112 |
| - |
113 |
| - <StackPanel> |
114 |
| - <StackPanel.DataContext> |
115 |
| - <MultiBinding Converter="{StaticResource FirstNotNullMultiConverter}"> |
116 |
| - <Binding Path="SelectedItem" ElementName="cbxVersions" /> |
117 |
| - <Binding /> |
118 |
| - </MultiBinding> |
119 |
| - </StackPanel.DataContext> |
120 |
| - |
121 |
| - <TextBox Text="{Binding Description, Mode=OneWay}" Style="{StaticResource ReadOnlyTextBoxStyle}" TextWrapping="Wrap" /> |
122 |
| - |
123 |
| - <Grid Margin="0,8,0,0"> |
124 |
| - <Grid.Resources> |
125 |
| - <Style TargetType="TextBlock"> |
126 |
| - <Setter Property="TextWrapping" Value="Wrap" /> |
127 |
| - </Style> |
128 |
| - </Grid.Resources> |
| 98 | + </Button.CommandParameter> |
| 99 | + </Button> |
129 | 100 |
|
130 |
| - <Grid.ColumnDefinitions> |
131 |
| - <ColumnDefinition Width="0.5*"/> |
132 |
| - <ColumnDefinition/> |
133 |
| - </Grid.ColumnDefinitions> |
134 |
| - <Grid.RowDefinitions> |
135 |
| - <RowDefinition/> |
136 |
| - <RowDefinition/> |
137 |
| - <RowDefinition/> |
138 |
| - <RowDefinition/> |
139 |
| - <RowDefinition/> |
140 |
| - <RowDefinition/> |
141 |
| - </Grid.RowDefinitions> |
142 |
| - |
143 |
| - <!-- Version --> |
144 |
| - <Label Grid.Row="0" Grid.Column="0" Content="Version:" /> |
145 |
| - <TextBlock Grid.Row="0" Grid.Column="1"> |
146 |
| - <Run Text="v" /><Run Text="{Binding Version, Mode=OneWay}" /> |
147 |
| - </TextBlock> |
148 |
| - |
149 |
| - <!-- Authors --> |
150 |
| - <Label Grid.Row="1" Grid.Column="0" Content="Authors:" /> |
151 |
| - <TextBlock Grid.Row="1" Grid.Column="1" Text="{Binding Authors, Mode=OneWay}" /> |
152 |
| - |
153 |
| - <!-- License URL --> |
154 |
| - <Label Grid.Row="2" Grid.Column="0" Content="License URL:" /> |
155 |
| - <TextBlock Grid.Row="2" Grid.Column="1"> |
156 |
| - <Hyperlink NavigateUri="{Binding LicenseUrl, Mode=OneWay}" ToolTip="{Binding LicenseUrl, Mode=OneWay}" RequestNavigate="Hyperlink_RequestNavigate"> |
157 |
| - <Run Text="{Binding LicenseUrl, Mode=OneWay}"/> |
158 |
| - </Hyperlink> |
159 |
| - </TextBlock> |
160 |
| - |
161 |
| - <!-- Published Date --> |
162 |
| - <Label Grid.Row="3" Grid.Column="0" Content="Published Date:" Visibility="{Binding Published, Converter={StaticResource NullToCollapsedConverter}}"/> |
163 |
| - <TextBlock Grid.Row="3" Grid.Column="1" Text="{Binding Published, Mode=OneWay}" Visibility="{Binding Published, Converter={StaticResource NullToCollapsedConverter}}" /> |
164 |
| - |
165 |
| - <!-- Project URL --> |
166 |
| - <Label Grid.Row="4" Grid.Column="0" Content="Project URL:" /> |
167 |
| - <TextBlock Grid.Row="4" Grid.Column="1"> |
168 |
| - <Hyperlink NavigateUri="{Binding ProjectUrl, Mode=OneWay}" ToolTip="{Binding ProjectUrl, Mode=OneWay}" RequestNavigate="Hyperlink_RequestNavigate"> |
169 |
| - <Run Text="{Binding ProjectUrl, Mode=OneWay}"/> |
170 |
| - </Hyperlink> |
171 |
| - </TextBlock> |
172 |
| - |
173 |
| - <!-- Tags --> |
174 |
| - <Label Grid.Row="5" Grid.Column="0" Content="Tags:" /> |
175 |
| - <TextBlock Grid.Row="6" Grid.Column="1" Text="{Binding Tags, Mode=OneWay}" Margin="0,0,0,8" /> |
176 |
| - </Grid> |
177 |
| - </StackPanel> |
| 101 | + <Button Content="Other versions.." Command="{Binding SelectedPackage.LoadVersions}" Visibility="{Binding SelectedPackage.AreVersionsLoaded, Converter={StaticResource FalseToVisibleConverter}}" MinWidth="100" MaxWidth="100" /> |
| 102 | + <ComboBox ItemsSource="{Binding SelectedPackage.Versions}" SelectedItem="{Binding SelectedVersion}" DisplayMemberPath="Version" ItemStringFormat="{}v{0}" |
| 103 | + SelectionChanged="cbxVersions_SelectionChanged" |
| 104 | + Visibility="{Binding SelectedPackage.AreVersionsLoaded, Converter={StaticResource TrueToVisibleConverter}}" MinWidth="100" MaxWidth="100" /> |
178 | 105 | </StackPanel>
|
179 |
| - </ScrollViewer> |
| 106 | + <views:PackageDetail> |
| 107 | + <views:PackageDetail.Model> |
| 108 | + <MultiBinding Converter="{StaticResource FirstNotNullMultiConverter}"> |
| 109 | + <Binding Path="SelectedVersion.Model" RelativeSource="{RelativeSource Mode=FindAncestor, AncestorType=views:Browser}" /> |
| 110 | + <Binding Path="SelectedPackage.Model" RelativeSource="{RelativeSource Mode=FindAncestor, AncestorType=views:Browser}" /> |
| 111 | + </MultiBinding> |
| 112 | + </views:PackageDetail.Model> |
| 113 | + </views:PackageDetail> |
| 114 | + </DockPanel> |
180 | 115 | </Border>
|
181 | 116 | </Grid>
|
182 | 117 |
|
|
0 commit comments