MessageWindow.xaml 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  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. <DockPanel>
  41. <Image x:Name="ImageControl" Margin="5" Source="{Binding Image}"
  42. DockPanel.Dock="Left" MaxWidth="50" MaxHeight="50">
  43. <Image.Style>
  44. <Style TargetType="Image">
  45. <Setter Property="Visibility" Value="Visible"/>
  46. <Style.Triggers>
  47. <DataTrigger Binding="{Binding Image}" Value="{x:Null}">
  48. <Setter Property="Visibility" Value="Collapsed"/>
  49. </DataTrigger>
  50. </Style.Triggers>
  51. </Style>
  52. </Image.Style>
  53. </Image>
  54. <TextBlock x:Name="MessageBox" Text="{Binding Message}"
  55. TextWrapping="Wrap"
  56. Margin="5" VerticalAlignment="Center"
  57. DockPanel.Dock="Right"/>
  58. </DockPanel>
  59. </Border>
  60. <Border Grid.Row="1"
  61. Background="WhiteSmoke" BorderBrush="Gray" BorderThickness="1" Margin="2,0,2,2">
  62. <Grid>
  63. <Grid.ColumnDefinitions>
  64. <ColumnDefinition Width="Auto"/>
  65. <ColumnDefinition Width="*"/>
  66. <ColumnDefinition Width="Auto"/>
  67. </Grid.ColumnDefinitions>
  68. <ItemsControl ItemsSource="{Binding LeftButtons}"
  69. Grid.Column="0"
  70. ItemTemplate="{StaticResource ButtonTemplate}">
  71. <ItemsControl.ItemsPanel>
  72. <ItemsPanelTemplate>
  73. <StackPanel Orientation="Horizontal"/>
  74. </ItemsPanelTemplate>
  75. </ItemsControl.ItemsPanel>
  76. </ItemsControl>
  77. <ItemsControl ItemsSource="{Binding RightButtons}"
  78. Grid.Column="2"
  79. ItemTemplate="{StaticResource ButtonTemplate}">
  80. <ItemsControl.ItemsPanel>
  81. <ItemsPanelTemplate>
  82. <StackPanel Orientation="Horizontal"/>
  83. </ItemsPanelTemplate>
  84. </ItemsControl.ItemsPanel>
  85. </ItemsControl>
  86. </Grid>
  87. </Border>
  88. <Border Grid.Row="2" BorderBrush="LightGray" BorderThickness="1"
  89. Margin="2" Padding="2" Background="White">
  90. <ScrollViewer VerticalScrollBarVisibility="Auto">
  91. <Border BorderBrush="LightGray" BorderThickness="1"
  92. Background="WhiteSmoke">
  93. <TextBlock x:Name="DetailsBox" Text="{Binding Details}"
  94. TextWrapping="Wrap"
  95. Padding="5" VerticalAlignment="Center"/>
  96. </Border>
  97. </ScrollViewer>
  98. </Border>
  99. </Grid>
  100. </Window>