Files
cefsharp/CefSharp.Wpf.Example/App.xaml
T
amaitland cb429ce9bf WPF - Improve ToolTip Text Wrapping
When no ToolTip style is defined we'll use a TextBlock to wrap the text so it's
usable by default. If a style is applied then we leave it up to user.

Resolves #2488
2020-04-08 16:43:47 +10:00

100 lines
5.3 KiB
XML

<Application x:Class="CefSharp.Wpf.Example.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="clr-namespace:CefSharp.Wpf.Example.Controls"
xmlns:view="clr-namespace:CefSharp.Wpf.Example.Views"
xmlns:viewModel="clr-namespace:CefSharp.Wpf.Example.ViewModels"
StartupUri="MainWindow.xaml">
<Application.Resources>
<!-- Used for testing https://github.com/cefsharp/CefSharp/issues/2488 -->
<!--<Style TargetType="ToolTip">
<Setter Property="ContentTemplate">
<Setter.Value>
<DataTemplate>
<StackPanel>
<TextBlock Text="{Binding}" MaxWidth="400" TextWrapping='Wrap' />
</StackPanel>
</DataTemplate>
</Setter.Value>
</Setter>
</Style>-->
<Style TargetType="{x:Type controls:NonReloadingTabControl}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type controls:NonReloadingTabControl}">
<Grid Background="{TemplateBinding Background}"
ClipToBounds="True"
KeyboardNavigation.TabNavigation="Local"
SnapsToDevicePixels="True">
<Grid.ColumnDefinitions>
<ColumnDefinition x:Name="ColumnDefinition0" />
<ColumnDefinition x:Name="ColumnDefinition1" Width="0" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition x:Name="RowDefinition0" Height="Auto" />
<RowDefinition x:Name="RowDefinition1" Height="*" />
</Grid.RowDefinitions>
<StackPanel Orientation="Horizontal">
<TabPanel x:Name="HeaderPanel"
Margin="0,0,0,-1"
VerticalAlignment="Bottom"
Panel.ZIndex="1"
IsItemsHost="True"
KeyboardNavigation.TabIndex="1" />
<Button Content="+"
FontSize="12"
FontWeight="Bold"
Margin="10, 0, 0, 0"
Width="25"
Command="ApplicationCommands.New" />
</StackPanel>
<Border x:Name="ContentPanel"
Grid.Row="1"
Grid.Column="0"
Background="Transparent"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
KeyboardNavigation.DirectionalNavigation="Contained"
KeyboardNavigation.TabIndex="2"
KeyboardNavigation.TabNavigation="Local">
<Grid x:Name="PART_ItemsHolder"
Margin="{TemplateBinding Padding}"
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
</Border>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style TargetType="TabItem">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="TabItem">
<Border Name="Border" BorderThickness="1,1,1,0" BorderBrush="Gainsboro" Margin="2,0">
<ContentPresenter x:Name="ContentSite"
VerticalAlignment="Center"
HorizontalAlignment="Center"
ContentSource="Header"
Margin="10,2"/>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsSelected" Value="True">
<Setter TargetName="Border" Property="Background" Value="LightSkyBlue" />
</Trigger>
<Trigger Property="IsSelected" Value="False">
<Setter TargetName="Border" Property="Background" Value="GhostWhite" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<DataTemplate DataType="{x:Type viewModel:BrowserTabViewModel}">
<view:BrowserTabView />
</DataTemplate>
</Application.Resources>
</Application>