|
9 | 9 | Background="#600" |
10 | 10 | Title="Slew Positions" MinHeight="250" MinWidth="405" WindowStyle="None" SizeToContent="Width"> |
11 | 11 | <Window.Resources> |
| 12 | + <converters:BoolToVisibilityConverter x:Key="BoolToShow" /> |
| 13 | + <converters:BoolToVisibilityConverter x:Key="BoolToHide" IsReversed="true" /> |
| 14 | + <Style x:Key="CustomListBoxItemStyle" TargetType="ListBoxItem"> |
| 15 | + <Setter Property="Background" Value="Transparent"/> |
| 16 | + <Setter Property="Foreground" Value="White"/> |
| 17 | + <Setter Property="BorderThickness" Value="0"/> |
| 18 | + <Setter Property="Padding" Value="0"/> |
| 19 | + <Setter Property="HorizontalContentAlignment" Value="Stretch"/> |
| 20 | + <Setter Property="VerticalContentAlignment" Value="Center"/> |
| 21 | + <Setter Property="SnapsToDevicePixels" Value="True"/> |
| 22 | + <Style.Triggers> |
| 23 | + <Trigger Property="IsSelected" Value="True"> |
| 24 | + <Setter Property="Background" Value="#400" /> |
| 25 | + </Trigger> |
| 26 | + <Trigger Property="IsMouseOver" Value="True"> |
| 27 | + <Setter Property="Background" Value="#600"/> |
| 28 | + </Trigger> |
| 29 | + </Style.Triggers> |
| 30 | + </Style> |
12 | 31 | <Style TargetType="ToolTip"> |
13 | 32 | <Setter Property="Background" Value="#600" /> |
14 | 33 | <Setter Property="Foreground" Value="#F00" /> |
|
54 | 73 | <Setter Property="Background" Value="{StaticResource AccentColorBrush2}" /> |
55 | 74 | <Setter Property="Foreground" Value="#F00" /> |
56 | 75 | </Style> |
| 76 | + <Style x:Key="TextBorder" TargetType="TextBox" BasedOn="{StaticResource MetroTextBox}"> |
| 77 | + <Setter Property="VerticalAlignment" Value="Center" /> |
| 78 | + <Setter Property="Padding" Value="0" /> |
| 79 | + <Setter Property="BorderBrush" Value="{StaticResource AccentColorBrush}" /> |
| 80 | + <Setter Property="Background" Value="{StaticResource AccentColorBrush3}" /> |
| 81 | + <Setter Property="HorizontalContentAlignment" Value="Left" /> |
| 82 | + <Setter Property="FontSize" Value="12" /> |
| 83 | + <Setter Property="MinWidth" Value="120" /> |
| 84 | + <Setter Property="Foreground" Value="#B00" /> |
| 85 | + </Style> |
57 | 86 | <Style x:Key="CustomButtonStyle" TargetType="Button"> |
58 | 87 | <Setter Property="Margin" Value="5" /> |
59 | 88 | <Setter Property="Padding" Value="10,5" /> |
|
389 | 418 | </Grid> |
390 | 419 |
|
391 | 420 | <ListBox x:Name="slewPointsList" Grid.Row="2" |
392 | | - ItemsSource="{Binding SlewPoints}" |
393 | | - Background="#300" |
394 | | - BorderBrush="#900" |
395 | | - Foreground="White" |
396 | | - Margin="0,0,0,0" |
397 | | - HorizontalContentAlignment="Stretch"> |
| 421 | + ItemsSource="{Binding SlewPoints}" |
| 422 | + Background="#300" |
| 423 | + BorderBrush="#900" |
| 424 | + Foreground="White" |
| 425 | + Margin="0,0,0,0" |
| 426 | + HorizontalContentAlignment="Stretch" |
| 427 | + ItemContainerStyle="{StaticResource CustomListBoxItemStyle}" |
| 428 | + > |
398 | 429 | <ListBox.ItemTemplate> |
399 | 430 | <DataTemplate> |
400 | | - <Border BorderThickness="0,1,0,0" BorderBrush="#200"> |
| 431 | + <Border BorderThickness="0,1,0,0" BorderBrush="#200" Background="{Binding RelativeSource={RelativeSource AncestorType=ListBoxItem}, Path=Background}"> |
401 | 432 | <Grid> |
402 | 433 | <Grid.ColumnDefinitions> |
403 | 434 | <ColumnDefinition Width="*"/> |
404 | 435 | <ColumnDefinition Width="60"/> |
405 | 436 | <ColumnDefinition Width="60"/> |
406 | 437 | <ColumnDefinition Width="125"/> |
407 | 438 | </Grid.ColumnDefinitions> |
408 | | - <TextBlock Text="{Binding Name}" Foreground="#B00" VerticalAlignment="Center" Padding="2,0" MinWidth="120"/> |
| 439 | + <Grid> |
| 440 | + <Grid.Resources> |
| 441 | + <Style TargetType="TextBox"> |
| 442 | + <Setter Property="MinWidth" Value="120"/> |
| 443 | + </Style> |
| 444 | + </Grid.Resources> |
| 445 | + <TextBlock x:Name="NameTextBlock" |
| 446 | + Text="{Binding Name}" |
| 447 | + Foreground="#B00" |
| 448 | + VerticalAlignment="Center" |
| 449 | + Padding="2,0" |
| 450 | + MinWidth="120" |
| 451 | + Visibility="{Binding IsEditing, Converter={StaticResource BoolToHide}}"/> |
| 452 | + <TextBox x:Name="NameTextBox" |
| 453 | + Text="{Binding Name, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" |
| 454 | + Style="{StaticResource TextBorder}" |
| 455 | + Background="#400" |
| 456 | + Visibility="{Binding IsEditing, Converter={StaticResource BoolToShow}}" |
| 457 | + KeyDown="NameTextBox_KeyDown" |
| 458 | + LostFocus="NameTextBox_LostFocus" |
| 459 | + IsVisibleChanged="NameTextBox_IsVisibleChanged"/> |
| 460 | + </Grid> |
409 | 461 | <TextBlock Text="{Binding RaStepperPosition}" Foreground="#B00" VerticalAlignment="Center" Grid.Column="1" TextAlignment="Center"/> |
410 | 462 | <TextBlock Text="{Binding DecStepperPosition}" Foreground="#B00" VerticalAlignment="Center" Grid.Column="2" TextAlignment="Center"/> |
411 | 463 | <StackPanel Grid.Column="3" Orientation="Horizontal" VerticalAlignment="Center"> |
|
0 commit comments