|
19 | 19 | <d:DesignProperties.DataContext> |
20 | 20 | <Binding> |
21 | 21 | <Binding.Source> |
22 | | - <sampleData:PullRequestDetailViewModelDesigner CheckoutMode="Push" |
23 | | - CommitsBehind="2"/> |
| 22 | + <sampleData:PullRequestDetailViewModelDesigner CheckoutMode="NeedsPull" |
| 23 | + CommitsBehind="2" |
| 24 | + CheckoutDisabledMessage="Cannot update branch as your working directory has uncommitted changes."/> |
24 | 25 | </Binding.Source> |
25 | 26 | </Binding> |
26 | 27 | </d:DesignProperties.DataContext> |
|
80 | 81 | <Style x:Key="CheckoutMessage" TargetType="TextBlock"> |
81 | 82 | <Setter Property="Margin" Value="0 4"/> |
82 | 83 | </Style> |
| 84 | + |
| 85 | + <!-- Hyperlink has no Visibility property, sigh. Hack around this by making the text |
| 86 | + transparent and 1 px in size. --> |
| 87 | + <Style x:Key="HyperlinkHiddenWhenDisabled" TargetType="Hyperlink"> |
| 88 | + <Style.Triggers> |
| 89 | + <Trigger Property="IsEnabled" Value="False"> |
| 90 | + <Setter Property="Foreground" Value="Transparent"/> |
| 91 | + <Setter Property="FontSize" Value="1"/> |
| 92 | + </Trigger> |
| 93 | + </Style.Triggers> |
| 94 | + </Style> |
83 | 95 | </ResourceDictionary> |
84 | 96 | </Control.Resources> |
85 | 97 |
|
|
191 | 203 | <ui:OcticonImage Icon="sync" Foreground="Orange" Margin="0 0 0 -4"/> |
192 | 204 | <Run>Your local branch is behind by</Run> |
193 | 205 | <Run FontWeight="Bold" Text="{Binding CommitsBehind, StringFormat={}{0} commits.}"/> |
194 | | - <Hyperlink Command="{Binding Checkout}">Update</Hyperlink> |
| 206 | + <Hyperlink Command="{Binding Checkout}" Style="{StaticResource HyperlinkHiddenWhenDisabled}">Update</Hyperlink> |
195 | 207 | <TextBlock.Style> |
196 | 208 | <Style TargetType="TextBlock" BasedOn="{StaticResource CheckoutMessage}"> |
197 | 209 | <Setter Property="Visibility" Value="Collapsed"/> |
|
207 | 219 | <!-- Local branch exists but is not checked out --> |
208 | 220 | <TextBlock TextWrapping="Wrap"> |
209 | 221 | <Run BaselineAlignment="Top">This branch is not currently checked out.</Run> |
210 | | - <Hyperlink Command="{Binding Checkout}">Switch branch</Hyperlink> |
| 222 | + <Hyperlink Command="{Binding Checkout}" Style="{StaticResource HyperlinkHiddenWhenDisabled}">Switch branch</Hyperlink> |
211 | 223 | <TextBlock.Style> |
212 | 224 | <Style TargetType="TextBlock" BasedOn="{StaticResource CheckoutMessage}"> |
213 | 225 | <Setter Property="Visibility" Value="Collapsed"/> |
|
224 | 236 | <TextBlock TextWrapping="Wrap"> |
225 | 237 | <ui:OcticonImage Icon="alert" Foreground="Orange" Margin="0 0 0 -4"/> |
226 | 238 | <Run BaselineAlignment="Top">The pull request branch has local changes.</Run> |
227 | | - <Hyperlink Command="{Binding Checkout}">Checkout to a new branch</Hyperlink> |
| 239 | + <Hyperlink Command="{Binding Checkout}" Style="{StaticResource HyperlinkHiddenWhenDisabled}">Checkout to a new branch</Hyperlink> |
228 | 240 | <TextBlock.Style> |
229 | 241 | <Style TargetType="TextBlock" BasedOn="{StaticResource CheckoutMessage}"> |
230 | 242 | <Setter Property="Visibility" Value="Collapsed"/> |
|
0 commit comments