新しいアプリのUIに悩むねこ(ΦωΦ);;
こやつの最新リリース
https://github.com/FizzFizzGit/FLS_CS/releases/tag/v1.1.1
BasedOnむずかしい
どうしてベタ書きしたStyleとBasedOnしたStyleでは表示が違うの…
特にボタンの背景色が表示され無くなってしまって途方に暮れている所。あとsize
とmargin
も変わってしまって変になっただよ…
MainWindow.xaml
<Window x:Class="GD_URIConvert.MainWindow"
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:GD_URIConvert"
mc:Ignorable="d"
Title="FF14 LodeStonetools"
Height="300"
Width="450"
Style="{StaticResource window_common}"
ResizeMode="CanResizeWithGrip">
<Window.Resources>
<Style x:Key="_CornerRadiusButtonStyle" TargetType="Button">
<Setter Property="FontFamily" Value="Century Gothic"/>
<Setter Property="FontSize" Value="16"/>
<Setter Property="FontWeight" Value="UltraBold"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Grid>
<Border
Name="border"
BorderThickness="0"
CornerRadius="3"/>
<ContentPresenter
VerticalAlignment="Center"
HorizontalAlignment="Center"/>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="Gray_CornerRadiusButtonStyle"
TargetType="Button"
BasedOn="{StaticResource _CornerRadiusButtonStyle}">
<Setter Property="Background" Value="#474747"/>
</Style>
<Style x:Key="Red_CornerRadiusButtonStyle"
TargetType="Button"
BasedOn="{StaticResource _CornerRadiusButtonStyle}">
<Setter Property="Background" Value="#dc143c"/>
</Style>
</Window.Resources>
<Grid>
<Grid.Resources>
<Style TargetType="Button">
<Setter Property="Margin" Value="0,5,5,5"/>
</Style>
<Style TargetType="ListBox">
<Setter Property="Margin" Value="5,0,0,0"/>
<Setter Property="BorderBrush" Value="#474747"/>
</Style>
<Style TargetType="TextBox">
<Setter Property="Margin" Value="5"/>
<Setter Property="Padding" Value="5"/>
<Setter Property="BorderBrush" Value="#474747"/>
</Style>
</Grid.Resources>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="40"/>
<RowDefinition/>
</Grid.RowDefinitions>
<Menu Grid.Row="0">
<MenuItem Header="Clear" Click="Button_Clear_Click"/>
<MenuItem Header="Help" Click="Button_Help_Click"/>
</Menu>
<!-- 上部のテキスト入力部 -->
<Grid Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition Width="100"/>
</Grid.ColumnDefinitions>
<TextBox x:Name="URL_Text"
Grid.Column="0"
VerticalContentAlignment="Center"
Text="URLを入力してください。"
GotFocus="OnGotFocusHandler"
LostFocus="OnLostFocusHandler">
</TextBox>
<Button x:Name="Button_Submit"
Grid.Column="1"
Content="Submit"
Click="Button_Submit_Click"
Foreground="White"
Style="{DynamicResource Gray_CornerRadiusButtonStyle}">
</Button>
</Grid>
<!-- 真ん中のリスト部 -->
<ScrollViewer x:Name="Scroll_Panel"
Grid.Row="2"
Margin="0,0,0,5"
>
<ListBox x:Name="URLList"
SelectionMode="Single"
ItemsSource="{Binding}">
<ListBox.ItemContainerStyle>
<!-- マウスオーバーで選択可能にするやつ -->
<Style TargetType="ListBoxItem">
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="IsSelected" Value="True"/>
</Trigger>
</Style.Triggers>
</Style>
</ListBox.ItemContainerStyle>
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<Button x:Name="Button_Erase"
Content="×"
Click="Button_Erase_Click"
Foreground="White"
Margin="0,0,5,0"
Width="20"
Height="100"
Style="{DynamicResource Red_CornerRadiusButtonStyle}">
</Button>
<Button x:Name="Button_SubWindowOpen"
Click="Button_SubWindowOpen_Click"
Width="100"
Height="100"
Style="{DynamicResource Gray_CornerRadiusButtonStyle}">
<Image Source="{Binding Graphic}" Width="100" Height="100"/>
</Button>
<Button x:Name="Button_Copy"
Click="Button_Copy_Click"
Height="100">
<TextBlock Text="{Binding URLText}"
TextWrapping="Wrap"
VerticalAlignment="Center"
HorizontalAlignment="Center"
Padding="5"/>
</Button>
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</ScrollViewer>
</Grid>
</Window>