feat: make banner bar as a user control
This commit is contained in:
@@ -6,9 +6,10 @@
|
||||
xmlns:local="clr-namespace:BallanceTasEditor.Frontend.Views"
|
||||
xmlns:vm="clr-namespace:BallanceTasEditor.Frontend.ViewModels"
|
||||
xmlns:conveter="clr-namespace:BallanceTasEditor.Frontend.Converters"
|
||||
xmlns:widget="clr-namespace:BallanceTasEditor.Frontend.Widgets"
|
||||
d:DataContext="{d:DesignInstance vm:NewFileDialog}"
|
||||
mc:Ignorable="d" WindowStartupLocation="CenterOwner" ResizeMode="NoResize" ShowInTaskbar="False"
|
||||
Title="New File" Height="250" Width="400" Icon="/Frontend/Assets/NewFile.ico">
|
||||
Title="New File" Height="250" Width="400" Icon="/Frontend/Assets/App.ico">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="auto"/>
|
||||
@@ -16,8 +17,9 @@
|
||||
<RowDefinition Height="auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<TextBlock Grid.Row="0" Text="Create new TAS file with given FPS and frame count."
|
||||
Style="{StaticResource NoteBannerStyle}"/>
|
||||
<widget:BannerBar Grid.Row="0"
|
||||
BannerText="Create new TAS file with given FPS and frame count."
|
||||
BannerIcon="/Frontend/Assets/NewFile.ico"/>
|
||||
|
||||
<Grid Grid.Row="1">
|
||||
<Grid.RowDefinitions>
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
<UserControl x:Class="BallanceTasEditor.Frontend.Widgets.BannerBar"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="clr-namespace:BallanceTasEditor.Frontend.Widgets"
|
||||
mc:Ignorable="d"
|
||||
x:Name="Root"
|
||||
d:DesignHeight="80" d:DesignWidth="600">
|
||||
<Border BorderThickness="0" Background="#0097A7" Padding="10">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="auto"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<Image Source="{Binding ElementName=Root, Path=BannerIcon, Mode=OneWay}"
|
||||
Width="32" Height="32" RenderOptions.BitmapScalingMode="HighQuality"
|
||||
Grid.Column="0" VerticalAlignment="Center">
|
||||
<Image.Effect>
|
||||
<DropShadowEffect Color="White" Direction="0" ShadowDepth="0" BlurRadius="20"/>
|
||||
</Image.Effect>
|
||||
</Image>
|
||||
<TextBlock Text="{Binding ElementName=Root, Path=BannerText, Mode=OneWay}"
|
||||
Grid.Column="1" Margin="10,0,0,0" VerticalAlignment="Center" HorizontalAlignment="Left"
|
||||
Foreground="#CDDC39" TextWrapping="Wrap"/>
|
||||
</Grid>
|
||||
</Border>
|
||||
</UserControl>
|
||||
@@ -0,0 +1,44 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace BallanceTasEditor.Frontend.Widgets {
|
||||
/// <summary>
|
||||
/// Interaction logic for BannerBar.xaml
|
||||
/// </summary>
|
||||
public partial class BannerBar : UserControl {
|
||||
public BannerBar() {
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
public string BannerText {
|
||||
get { return (string)GetValue(BannerTextProperty); }
|
||||
set { SetValue(BannerTextProperty, value); }
|
||||
}
|
||||
|
||||
// Using a DependencyProperty as the backing store for BannerText. This enables animation, styling, binding, etc...
|
||||
public static readonly DependencyProperty BannerTextProperty =
|
||||
DependencyProperty.Register("BannerText", typeof(string), typeof(BannerBar));
|
||||
|
||||
public ImageSource BannerIcon {
|
||||
get { return (ImageSource)GetValue(BannerIconProperty); }
|
||||
set { SetValue(BannerIconProperty, value); }
|
||||
}
|
||||
|
||||
// Using a DependencyProperty as the backing store for BannerIcon. This enables animation, styling, binding, etc...
|
||||
public static readonly DependencyProperty BannerIconProperty =
|
||||
DependencyProperty.Register("BannerIcon", typeof(ImageSource), typeof(BannerBar));
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user