MessageWindow.xaml 3.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. <Window x:Class="InABox.Wpf.MessageWindow"
  2. xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  3. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  4. xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
  5. xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
  6. xmlns:local="clr-namespace:InABox.Wpf"
  7. mc:Ignorable="d"
  8. Width="280"
  9. SizeToContent="Height"
  10. x:Name="Window"
  11. DataContext="{Binding ElementName=Window}">
  12. <Window.Resources>
  13. <DataTemplate x:Key="ButtonTemplate" DataType="local:MessageWindowButton">
  14. <Button Content="{Binding Content}"
  15. MinWidth="75" Padding="5" Margin="5"
  16. Click="Button_Click"
  17. Tag="{Binding}">
  18. </Button>
  19. </DataTemplate>
  20. </Window.Resources>
  21. <Grid>
  22. <Grid.RowDefinitions>
  23. <RowDefinition Height="*" MinHeight="100"/>
  24. <RowDefinition Height="Auto"/>
  25. <RowDefinition MaxHeight="150">
  26. <RowDefinition.Style>
  27. <Style TargetType="RowDefinition">
  28. <Setter Property="Height" Value="0"/>
  29. <Style.Triggers>
  30. <DataTrigger Binding="{Binding ShowDetails}" Value="True">
  31. <Setter Property="Height" Value="*"/>
  32. </DataTrigger>
  33. </Style.Triggers>
  34. </Style>
  35. </RowDefinition.Style>
  36. </RowDefinition>
  37. </Grid.RowDefinitions>
  38. <Border Grid.Row="0" BorderBrush="LightGray" BorderThickness="1"
  39. Margin="2" Padding="5" Background="White">
  40. <TextBlock x:Name="MessageBox" Text="{Binding Message}"
  41. TextWrapping="Wrap"
  42. Margin="5" VerticalAlignment="Center"/>
  43. </Border>
  44. <Border Grid.Row="1"
  45. Background="WhiteSmoke" BorderBrush="Gray" BorderThickness="1" Margin="2,0,2,2">
  46. <Grid>
  47. <Grid.ColumnDefinitions>
  48. <ColumnDefinition Width="Auto"/>
  49. <ColumnDefinition Width="*"/>
  50. <ColumnDefinition Width="Auto"/>
  51. </Grid.ColumnDefinitions>
  52. <ItemsControl ItemsSource="{Binding LeftButtons}"
  53. Grid.Column="0"
  54. ItemTemplate="{StaticResource ButtonTemplate}">
  55. <ItemsControl.ItemsPanel>
  56. <ItemsPanelTemplate>
  57. <StackPanel Orientation="Horizontal"/>
  58. </ItemsPanelTemplate>
  59. </ItemsControl.ItemsPanel>
  60. </ItemsControl>
  61. <ItemsControl ItemsSource="{Binding RightButtons}"
  62. Grid.Column="2"
  63. ItemTemplate="{StaticResource ButtonTemplate}">
  64. <ItemsControl.ItemsPanel>
  65. <ItemsPanelTemplate>
  66. <StackPanel Orientation="Horizontal"/>
  67. </ItemsPanelTemplate>
  68. </ItemsControl.ItemsPanel>
  69. </ItemsControl>
  70. </Grid>
  71. </Border>
  72. <Border Grid.Row="2" BorderBrush="LightGray" BorderThickness="1"
  73. Margin="2" Padding="2" Background="White">
  74. <ScrollViewer VerticalScrollBarVisibility="Auto">
  75. <Border BorderBrush="LightGray" BorderThickness="1"
  76. Background="WhiteSmoke">
  77. <TextBlock x:Name="DetailsBox" Text="{Binding Details}"
  78. TextWrapping="Wrap"
  79. Padding="5" VerticalAlignment="Center"/>
  80. </Border>
  81. </ScrollViewer>
  82. </Border>
  83. </Grid>
  84. </Window>