12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485 |
- <Window x:Class="InABox.Wpf.MessageWindow"
- xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
- xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
- xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
- xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
- xmlns:local="clr-namespace:InABox.Wpf"
- mc:Ignorable="d"
- Width="280"
- SizeToContent="Height"
- x:Name="Window"
- DataContext="{Binding ElementName=Window}">
- <Window.Resources>
- <DataTemplate x:Key="ButtonTemplate" DataType="local:MessageWindowButton">
- <Button Content="{Binding Content}"
- MinWidth="75" Padding="5" Margin="5"
- Click="Button_Click"
- Tag="{Binding}">
- </Button>
- </DataTemplate>
- </Window.Resources>
- <Grid>
- <Grid.RowDefinitions>
- <RowDefinition Height="*" MinHeight="100"/>
- <RowDefinition Height="Auto"/>
- <RowDefinition MaxHeight="150">
- <RowDefinition.Style>
- <Style TargetType="RowDefinition">
- <Setter Property="Height" Value="0"/>
- <Style.Triggers>
- <DataTrigger Binding="{Binding ShowDetails}" Value="True">
- <Setter Property="Height" Value="*"/>
- </DataTrigger>
- </Style.Triggers>
- </Style>
- </RowDefinition.Style>
- </RowDefinition>
- </Grid.RowDefinitions>
- <Border Grid.Row="0" BorderBrush="LightGray" BorderThickness="1"
- Margin="2" Padding="5" Background="White">
- <TextBlock x:Name="MessageBox" Text="{Binding Message}"
- TextWrapping="Wrap"
- Margin="5" VerticalAlignment="Center"/>
- </Border>
- <Border Grid.Row="1"
- Background="WhiteSmoke" BorderBrush="Gray" BorderThickness="1" Margin="2,0,2,2">
- <Grid>
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="Auto"/>
- <ColumnDefinition Width="*"/>
- <ColumnDefinition Width="Auto"/>
- </Grid.ColumnDefinitions>
- <ItemsControl ItemsSource="{Binding LeftButtons}"
- Grid.Column="0"
- ItemTemplate="{StaticResource ButtonTemplate}">
- <ItemsControl.ItemsPanel>
- <ItemsPanelTemplate>
- <StackPanel Orientation="Horizontal"/>
- </ItemsPanelTemplate>
- </ItemsControl.ItemsPanel>
- </ItemsControl>
- <ItemsControl ItemsSource="{Binding RightButtons}"
- Grid.Column="2"
- ItemTemplate="{StaticResource ButtonTemplate}">
- <ItemsControl.ItemsPanel>
- <ItemsPanelTemplate>
- <StackPanel Orientation="Horizontal"/>
- </ItemsPanelTemplate>
- </ItemsControl.ItemsPanel>
- </ItemsControl>
- </Grid>
- </Border>
- <Border Grid.Row="2" BorderBrush="LightGray" BorderThickness="1"
- Margin="2" Padding="2" Background="White">
- <ScrollViewer VerticalScrollBarVisibility="Auto">
- <Border BorderBrush="LightGray" BorderThickness="1"
- Background="WhiteSmoke">
- <TextBlock x:Name="DetailsBox" Text="{Binding Details}"
- TextWrapping="Wrap"
- Padding="5" VerticalAlignment="Center"/>
- </Border>
- </ScrollViewer>
- </Border>
- </Grid>
- </Window>
|