|
9 | 9 | UseLayoutRounding="True"> |
10 | 10 |
|
11 | 11 | <UserControl.Resources> |
12 | | - <!-- Define the reusable HoverVisibleButtonStyle --> |
| 12 | + <BooleanToVisibilityConverter x:Key="BoolToVisibilityConverter" /> |
13 | 13 | <Style x:Key="HoverVisibleButtonStyle" TargetType="Button"> |
14 | 14 | <Setter Property="Visibility" Value="Hidden" /> |
15 | 15 | <Setter Property="VerticalAlignment" Value="Stretch" /> |
|
22 | 22 | <Setter Property="Template"> |
23 | 23 | <Setter.Value> |
24 | 24 | <ControlTemplate TargetType="Button"> |
25 | | - <Border Background="{TemplateBinding Background}" BorderThickness="0" SnapsToDevicePixels="True"> |
| 25 | + <Border Background="{TemplateBinding Background}" BorderThickness="0" |
| 26 | + SnapsToDevicePixels="True"> |
26 | 27 | <ContentPresenter |
27 | 28 | HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" |
28 | 29 | VerticalAlignment="{TemplateBinding VerticalContentAlignment}" /> |
|
358 | 359 | Style="{StaticResource HoverVisibleButtonStyle}" |
359 | 360 | Content="🡸"> |
360 | 361 | </Button> |
361 | | - <Button Click="SelectedPatch_MoveUp" |
| 362 | + <Button x:Name="UpButton" |
| 363 | + Click="SelectedPatch_MoveUp" |
362 | 364 | Grid.Column="1" |
363 | 365 | Grid.Row="0" |
364 | 366 | Tag="{Binding}" |
365 | | - Margin="0" |
366 | | - Style="{StaticResource HoverVisibleButtonStyle}" |
367 | 367 | Content="🡹"> |
| 368 | + <Button.Style> |
| 369 | + <Style TargetType="Button"> |
| 370 | + <Setter Property="Visibility" Value="Hidden" /> |
| 371 | + <Setter Property="VerticalAlignment" Value="Stretch" /> |
| 372 | + <Setter Property="HorizontalAlignment" Value="Stretch" /> |
| 373 | + <Setter Property="Padding" Value="0,0" /> |
| 374 | + <Setter Property="Margin" Value="0" /> |
| 375 | + <Setter Property="Background" Value="White" /> |
| 376 | + <Setter Property="BorderThickness" Value="0" /> |
| 377 | + <Setter Property="BorderBrush" Value="Transparent" /> |
| 378 | + <Setter Property="Template"> |
| 379 | + <Setter.Value> |
| 380 | + <ControlTemplate TargetType="Button"> |
| 381 | + <Border Background="{TemplateBinding Background}" |
| 382 | + BorderThickness="0" SnapsToDevicePixels="True"> |
| 383 | + <ContentPresenter |
| 384 | + HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" |
| 385 | + VerticalAlignment="{TemplateBinding VerticalContentAlignment}" /> |
| 386 | + </Border> |
| 387 | + </ControlTemplate> |
| 388 | + </Setter.Value> |
| 389 | + </Setter> |
| 390 | + |
| 391 | + <Style.Triggers> |
| 392 | + <!-- Regular Hover style --> |
| 393 | + <DataTrigger |
| 394 | + Binding="{Binding IsMouseOver, RelativeSource={RelativeSource Self}}" |
| 395 | + Value="True"> |
| 396 | + <Setter Property="Foreground" Value="DodgerBlue" /> |
| 397 | + <Setter Property="Background" Value="White" /> |
| 398 | + </DataTrigger> |
| 399 | + |
| 400 | + <!-- Visibility condition --> |
| 401 | + <MultiDataTrigger> |
| 402 | + <MultiDataTrigger.Conditions> |
| 403 | + <!-- Hover Over Parent Grid --> |
| 404 | + <Condition |
| 405 | + Binding="{Binding IsMouseOver, RelativeSource={RelativeSource AncestorType=Grid}}" |
| 406 | + Value="True" /> |
| 407 | + <!-- IsNotFirst condition --> |
| 408 | + <Condition Binding="{Binding IsNotFirst}" Value="True" /> |
| 409 | + </MultiDataTrigger.Conditions> |
| 410 | + <Setter Property="Visibility" Value="Visible" /> |
| 411 | + </MultiDataTrigger> |
| 412 | + </Style.Triggers> |
| 413 | + </Style> |
| 414 | + </Button.Style> |
368 | 415 | </Button> |
369 | | - <Button Click="SelectedPatch_MoveDown" |
| 416 | + <Button x:Name="DownButton" |
| 417 | + Click="SelectedPatch_MoveDown" |
370 | 418 | Grid.Column="1" |
371 | 419 | Grid.Row="1" |
372 | 420 | Tag="{Binding}" |
373 | | - Margin="0" |
374 | | - Style="{StaticResource HoverVisibleButtonStyle}" |
375 | 421 | Content="🡻"> |
| 422 | + <Button.Style> |
| 423 | + <Style TargetType="Button"> |
| 424 | + <Setter Property="Visibility" Value="Hidden" /> |
| 425 | + <Setter Property="VerticalAlignment" Value="Stretch" /> |
| 426 | + <Setter Property="HorizontalAlignment" Value="Stretch" /> |
| 427 | + <Setter Property="Padding" Value="0,0" /> |
| 428 | + <Setter Property="Margin" Value="0" /> |
| 429 | + <Setter Property="Background" Value="White" /> |
| 430 | + <Setter Property="BorderThickness" Value="0" /> |
| 431 | + <Setter Property="BorderBrush" Value="Transparent" /> |
| 432 | + <Setter Property="Template"> |
| 433 | + <Setter.Value> |
| 434 | + <ControlTemplate TargetType="Button"> |
| 435 | + <Border Background="{TemplateBinding Background}" |
| 436 | + BorderThickness="0" SnapsToDevicePixels="True"> |
| 437 | + <ContentPresenter |
| 438 | + HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" |
| 439 | + VerticalAlignment="{TemplateBinding VerticalContentAlignment}" /> |
| 440 | + </Border> |
| 441 | + </ControlTemplate> |
| 442 | + </Setter.Value> |
| 443 | + </Setter> |
| 444 | + |
| 445 | + <Style.Triggers> |
| 446 | + <!-- Regular Hover style --> |
| 447 | + <DataTrigger |
| 448 | + Binding="{Binding IsMouseOver, RelativeSource={RelativeSource Self}}" |
| 449 | + Value="True"> |
| 450 | + <Setter Property="Foreground" Value="DodgerBlue" /> |
| 451 | + <Setter Property="Background" Value="White" /> |
| 452 | + </DataTrigger> |
| 453 | + |
| 454 | + <!-- Visibility condition --> |
| 455 | + <MultiDataTrigger> |
| 456 | + <MultiDataTrigger.Conditions> |
| 457 | + <!-- Hover Over Parent Grid --> |
| 458 | + <Condition |
| 459 | + Binding="{Binding IsMouseOver, RelativeSource={RelativeSource AncestorType=Grid}}" |
| 460 | + Value="True" /> |
| 461 | + <!-- IsNotLast condition --> |
| 462 | + <Condition Binding="{Binding IsNotLast}" Value="True" /> |
| 463 | + </MultiDataTrigger.Conditions> |
| 464 | + <Setter Property="Visibility" Value="Visible" /> |
| 465 | + </MultiDataTrigger> |
| 466 | + </Style.Triggers> |
| 467 | + </Style> |
| 468 | + </Button.Style> |
376 | 469 | </Button> |
377 | 470 | </Grid> |
378 | 471 | </DataTemplate> |
|
0 commit comments