-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added "Content Collections Item" (#17)
- Loading branch information
1 parent
6901be8
commit 44413c1
Showing
2 changed files
with
112 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<UserControl x:Class="Datalya.UserControls.ContentCollectionItem" | ||
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:Datalya.UserControls" | ||
mc:Ignorable="d" FontFamily="..\Fonts\#Monserrat" | ||
Height="35" Width="275"> | ||
|
||
<Border VerticalAlignment="Center"> | ||
<Button x:Name="ItemBtn" Click="ItemBtn_Click" Style="{StaticResource TabButtonStyle}" MouseEnter="ItemBtn_MouseEnter" MouseLeave="ItemBtn_MouseLeave" Background="{Binding Source={StaticResource Background2}}" Foreground="{Binding Source={StaticResource Foreground1}}" Cursor="Hand" BorderThickness="0" Margin="0,0,0,5" VerticalAlignment="Center"> | ||
<Grid Height="35" Width="275" VerticalAlignment="Center"> | ||
<Grid.ColumnDefinitions> | ||
<ColumnDefinition/> | ||
<ColumnDefinition Width="Auto"/> | ||
<ColumnDefinition Width="Auto"/> | ||
<ColumnDefinition Width="Auto"/> | ||
</Grid.ColumnDefinitions> | ||
|
||
<TextBlock Grid.Column="0" x:Name="NameTxt" d:Text="NameText" FontWeight="Bold" FontSize="14" Margin="10,0,5,0" VerticalAlignment="Center" MouseDown="NameTxt_MouseDown" LineStackingStrategy="MaxHeight"/> | ||
</Grid> | ||
</Button> | ||
</Border> | ||
</UserControl> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
/* | ||
MIT License | ||
Copyright (c) Léo Corporation | ||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. | ||
*/ | ||
using Datalya.Classes; | ||
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 Datalya.UserControls | ||
{ | ||
/// <summary> | ||
/// Interaction logic for ContentCollectionItem.xaml | ||
/// </summary> | ||
public partial class ContentCollectionItem : UserControl | ||
{ | ||
public ContentCollection ContentCollection { get; init; } | ||
public Action<ContentCollection> CloseEvent { get; init; } | ||
|
||
public ContentCollectionItem(ContentCollection contentCollection, Action<ContentCollection> closeEvent) | ||
{ | ||
InitializeComponent(); | ||
ContentCollection = contentCollection; // Set | ||
CloseEvent = closeEvent; | ||
|
||
InitUI(); // Load the UI | ||
} | ||
|
||
public void InitUI() | ||
{ | ||
NameTxt.Text = ContentCollection.Name; // Set text | ||
} | ||
|
||
private void ItemBtn_MouseEnter(object sender, MouseEventArgs e) | ||
{ | ||
Button button = (Button)sender; // Create button | ||
|
||
button.Foreground = new SolidColorBrush { Color = (Color)ColorConverter.ConvertFromString(App.Current.Resources["WindowButtonsHoverForeground1"].ToString()) }; // Set the foreground | ||
} | ||
|
||
private void ItemBtn_MouseLeave(object sender, MouseEventArgs e) | ||
{ | ||
Button button = (Button)sender; // Create button | ||
|
||
button.Foreground = new SolidColorBrush { Color = (Color)ColorConverter.ConvertFromString(App.Current.Resources["Foreground1"].ToString()) }; // Set the foreground | ||
} | ||
|
||
private void NameTxt_MouseDown(object sender, MouseButtonEventArgs e) | ||
{ | ||
CloseEvent(ContentCollection); | ||
} | ||
|
||
private void ItemBtn_Click(object sender, RoutedEventArgs e) | ||
{ | ||
|
||
} | ||
} | ||
} |