✨ 增加隐藏标题功能
This commit is contained in:
@@ -111,6 +111,7 @@
|
||||
<cvt:OpcityConvert x:Key="OpcityConvert"/>
|
||||
<cvt:GetWidthByWWConvert x:Key="GetWidthByWWConvert"/>
|
||||
<temp:SearchIconList x:Key="SearchIconList"/>
|
||||
<cvt:Boolean2VisibilityConverter x:Key="MyBoolean2VisibilityConverter"/>
|
||||
</UserControl.Resources>
|
||||
<!--右侧栏-->
|
||||
<Grid>
|
||||
@@ -148,6 +149,7 @@
|
||||
<MenuItem Header="添加URL项目" Click="AddUrlIcon"/>
|
||||
<MenuItem Header="添加系统项目" Click="AddSystemIcon"/>
|
||||
<MenuItem x:Name="CardLockCM" Header="锁定主面板" Click="LockAppPanel"/>
|
||||
<MenuItem x:Name="showTitle" Header="隐藏/显示标题" Click="ShowTitle_Click"/>
|
||||
</ContextMenu>
|
||||
</hc:Card.ContextMenu>
|
||||
<hc:DialogContainer>
|
||||
@@ -247,12 +249,16 @@
|
||||
MouseLeftButtonDown="Icon_MouseLeftButtonDown"
|
||||
MouseLeftButtonUp="Icon_MouseLeftButtonUp"
|
||||
>
|
||||
<CheckBox Margin="0,0,0,-20" HorizontalAlignment="Right"/>
|
||||
<!--<StackPanel Background="#00FFFFFF"
|
||||
MouseEnter="CursorPanel_MouseEnter"
|
||||
MouseLeave="CursorPanel_MouseLeave"
|
||||
Width="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.ImageWidth, Mode=OneWay}">-->
|
||||
<Image Style="{StaticResource ImageStyle}"
|
||||
RenderOptions.BitmapScalingMode="HighQuality"/>
|
||||
<!--Width="{Binding AppConfig.WindowWidth, Mode=OneWay,
|
||||
Converter={StaticResource GetWidthByWWConvert},
|
||||
ConverterParameter={x:Static cst:WidthTypeEnum.RIGHT_CARD_70}}"-->
|
||||
<TextBlock MaxWidth="80"
|
||||
Margin="0,5,0,0"
|
||||
MaxHeight="40"
|
||||
@@ -262,6 +268,7 @@
|
||||
TextAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
Foreground="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.TextColor}"
|
||||
Visibility="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.ShowIconTitle, Converter={StaticResource MyBoolean2VisibilityConverter}, ConverterParameter={x:Static Visibility.Collapsed}, Mode=TwoWay}"
|
||||
Text="{Binding Name}"/>
|
||||
<!--</StackPanel>-->
|
||||
|
||||
|
||||
@@ -353,7 +353,7 @@ namespace GeekDesk.Control.UserControls.PannelCard
|
||||
|
||||
DependencyObject dos = sp.Parent;
|
||||
|
||||
Image img = sp.Children[0] as Image;
|
||||
Image img = sp.Children[1] as Image;
|
||||
|
||||
double afterHeight = img.Height;
|
||||
double afterWidth = img.Width;
|
||||
@@ -683,6 +683,14 @@ namespace GeekDesk.Control.UserControls.PannelCard
|
||||
MyPoptip.VerticalOffset = 30;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 控制图标标题显示及隐藏
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void ShowTitle_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
appData.AppConfig.ShowIconTitle = !appData.AppConfig.ShowIconTitle;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
39
Converts/Boolean2VisibilityConverter.cs
Normal file
39
Converts/Boolean2VisibilityConverter.cs
Normal file
@@ -0,0 +1,39 @@
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Windows;
|
||||
using System.Windows.Data;
|
||||
|
||||
namespace GeekDesk.Converts
|
||||
{
|
||||
internal class Boolean2VisibilityConverter : IValueConverter
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
bool param = false;
|
||||
if (value != null)
|
||||
{
|
||||
param = (bool)value;
|
||||
}
|
||||
if (param)
|
||||
{
|
||||
return Visibility.Visible;
|
||||
} else
|
||||
{
|
||||
return (Visibility)parameter;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
if ((bool)value)
|
||||
{
|
||||
return Visibility.Visible;
|
||||
}
|
||||
else
|
||||
{
|
||||
return Visibility.Hidden;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user