优化搜索框失焦
This commit is contained in:
@@ -77,10 +77,11 @@
|
|||||||
</UserControl.Resources>
|
</UserControl.Resources>
|
||||||
<!--左侧栏-->
|
<!--左侧栏-->
|
||||||
<hc:Card x:Name="MyCard"
|
<hc:Card x:Name="MyCard"
|
||||||
BorderThickness="1"
|
BorderThickness="1"
|
||||||
Effect="{DynamicResource EffectShadow2}"
|
Effect="{DynamicResource EffectShadow2}"
|
||||||
Margin="5,0,0,5"
|
Margin="5,0,0,5"
|
||||||
>
|
MouseDown="MyCard_MouseDown"
|
||||||
|
>
|
||||||
<hc:Card.Background>
|
<hc:Card.Background>
|
||||||
<SolidColorBrush Color="#FFFFFFFF" hc:GeometryEffect.GeometryEffect="20" Opacity="{Binding AppConfig.CardOpacity, Mode=TwoWay, Converter={StaticResource OpcityConvert}}">
|
<SolidColorBrush Color="#FFFFFFFF" hc:GeometryEffect.GeometryEffect="20" Opacity="{Binding AppConfig.CardOpacity, Mode=TwoWay, Converter={StaticResource OpcityConvert}}">
|
||||||
|
|
||||||
@@ -130,7 +131,7 @@
|
|||||||
|
|
||||||
<ListBox.ItemTemplate>
|
<ListBox.ItemTemplate>
|
||||||
<DataTemplate>
|
<DataTemplate>
|
||||||
<StackPanel Tag="{Binding}">
|
<StackPanel Tag="{Binding}" MouseDown="ListBoxItem_MouseDown">
|
||||||
<TextBox Text="{Binding Path=MenuName, Mode=TwoWay}"
|
<TextBox Text="{Binding Path=MenuName, Mode=TwoWay}"
|
||||||
HorizontalAlignment="Left"
|
HorizontalAlignment="Left"
|
||||||
Width="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type ListBox},AncestorLevel=1},Path=Tag, Mode=TwoWay, Converter={StaticResource MenuWidthConvert}, ConverterParameter=35}"
|
Width="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type ListBox},AncestorLevel=1},Path=Tag, Mode=TwoWay, Converter={StaticResource MenuWidthConvert}, ConverterParameter=35}"
|
||||||
|
|||||||
@@ -349,6 +349,29 @@ namespace GeekDesk.Control.UserControls.PannelCard
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 点击菜单后 隐藏搜索框
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
|
private void ListBoxItem_MouseDown(object sender, MouseButtonEventArgs e)
|
||||||
|
{
|
||||||
|
if (RunTimeStatus.SEARCH_BOX_SHOW) {
|
||||||
|
MainWindow.mainWindow.HidedSearchBox();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 隐藏搜索框
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
|
private void MyCard_MouseDown(object sender, MouseButtonEventArgs e)
|
||||||
|
{
|
||||||
|
if (RunTimeStatus.SEARCH_BOX_SHOW)
|
||||||
|
{
|
||||||
|
MainWindow.mainWindow.HidedSearchBox();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,6 +20,14 @@
|
|||||||
</Style.Triggers>
|
</Style.Triggers>
|
||||||
</Style>-->
|
</Style>-->
|
||||||
|
|
||||||
|
<Storyboard x:Key="Custom1Transition" x:Shared="False">
|
||||||
|
<DoubleAnimation From="50" To="0" Duration="0:0:0.4" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.X)">
|
||||||
|
<DoubleAnimation.EasingFunction>
|
||||||
|
<ElasticEase Oscillations="1"/>
|
||||||
|
</DoubleAnimation.EasingFunction>
|
||||||
|
</DoubleAnimation>
|
||||||
|
</Storyboard>
|
||||||
|
|
||||||
<Style x:Key="ImageStyle" TargetType="Image">
|
<Style x:Key="ImageStyle" TargetType="Image">
|
||||||
<Setter Property="Width" Value="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.ImageWidth, Mode=OneWay}"/>
|
<Setter Property="Width" Value="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.ImageWidth, Mode=OneWay}"/>
|
||||||
<Setter Property="Height" Value="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.ImageHeight, Mode=OneWay}"/>
|
<Setter Property="Height" Value="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.ImageHeight, Mode=OneWay}"/>
|
||||||
@@ -107,26 +115,33 @@
|
|||||||
<ListBox.ItemTemplate>
|
<ListBox.ItemTemplate>
|
||||||
<DataTemplate>
|
<DataTemplate>
|
||||||
<hc:SimpleStackPanel Tag="{Binding}"
|
<hc:SimpleStackPanel Tag="{Binding}"
|
||||||
Height="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.ImgPanelHeight, Mode=OneWay}"
|
Height="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.ImgPanelHeight, Mode=OneWay}"
|
||||||
Width="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.ImgPanelWidth, Mode=OneWay}"
|
Width="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.ImgPanelWidth, Mode=OneWay}"
|
||||||
HorizontalAlignment="Center"
|
HorizontalAlignment="Center"
|
||||||
hc:Poptip.Content="{Binding Content}"
|
hc:Poptip.Content="{Binding Content}"
|
||||||
hc:Poptip.Placement="BottomLeft"
|
hc:Poptip.Placement="BottomLeft"
|
||||||
Background="#00FFFFFF"
|
Background="#00FFFFFF"
|
||||||
MouseEnter="StackPanel_MouseEnter"
|
MouseEnter="StackPanel_MouseEnter"
|
||||||
MouseLeave="StackPanel_MouseLeave"
|
MouseLeave="StackPanel_MouseLeave"
|
||||||
>
|
>
|
||||||
<Image Style="{StaticResource ImageStyle}" RenderOptions.BitmapScalingMode="HighQuality"/>
|
<!--<StackPanel Background="#00FFFFFF"
|
||||||
<TextBlock MaxWidth="80"
|
MouseEnter="CursorPanel_MouseEnter"
|
||||||
Margin="0,5,0,0"
|
MouseLeave="CursorPanel_MouseLeave"
|
||||||
MaxHeight="40"
|
Width="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.ImageWidth, Mode=OneWay}">-->
|
||||||
FontSize="13"
|
<Image Style="{StaticResource ImageStyle}"
|
||||||
TextWrapping="Wrap"
|
RenderOptions.BitmapScalingMode="HighQuality"/>
|
||||||
TextTrimming="WordEllipsis"
|
<TextBlock MaxWidth="80"
|
||||||
TextAlignment="Center"
|
Margin="0,5,0,0"
|
||||||
VerticalAlignment="Center"
|
MaxHeight="40"
|
||||||
Foreground="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.TextColor}"
|
FontSize="13"
|
||||||
Text="{Binding Name}"/>
|
TextWrapping="Wrap"
|
||||||
|
TextTrimming="WordEllipsis"
|
||||||
|
TextAlignment="Center"
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
Foreground="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.TextColor}"
|
||||||
|
Text="{Binding Name}"/>
|
||||||
|
<!--</StackPanel>-->
|
||||||
|
|
||||||
</hc:SimpleStackPanel>
|
</hc:SimpleStackPanel>
|
||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
</ListBox.ItemTemplate>
|
</ListBox.ItemTemplate>
|
||||||
@@ -158,42 +173,43 @@
|
|||||||
VirtualizingPanel.IsVirtualizing="True"
|
VirtualizingPanel.IsVirtualizing="True"
|
||||||
VirtualizingPanel.IsContainerVirtualizable="True"
|
VirtualizingPanel.IsContainerVirtualizable="True"
|
||||||
>
|
>
|
||||||
<ListBox ItemsSource="{Binding Source={StaticResource SearchIconList},Path=IconList}"
|
<hc:TransitioningContentControl TransitionStoryboard="{StaticResource Custom1Transition}">
|
||||||
|
<ListBox ItemsSource="{Binding Source={StaticResource SearchIconList},Path=IconList}"
|
||||||
BorderThickness="0"
|
BorderThickness="0"
|
||||||
Padding="0,10,0,0"
|
Padding="0,10,0,0"
|
||||||
>
|
>
|
||||||
<ListBox.Background>
|
<ListBox.Background>
|
||||||
<SolidColorBrush Opacity="0"/>
|
<SolidColorBrush Opacity="0"/>
|
||||||
</ListBox.Background>
|
</ListBox.Background>
|
||||||
|
|
||||||
<ListBox.Resources>
|
<ListBox.Resources>
|
||||||
<ContextMenu x:Key="IconDialog" Width="200">
|
<ContextMenu x:Key="IconDialog" Width="200">
|
||||||
<MenuItem Header="管理员方式运行" Click="IconAdminStart" Tag="{Binding}"/>
|
<MenuItem Header="管理员方式运行" Click="IconAdminStart" Tag="{Binding}"/>
|
||||||
<MenuItem Header="打开文件所在位置" Click="ShowInExplore" Tag="{Binding}"/>
|
<MenuItem Header="打开文件所在位置" Click="ShowInExplore" Tag="{Binding}"/>
|
||||||
<MenuItem Header="添加URL项目" Click="AddUrlIcon"/>
|
<MenuItem Header="添加URL项目" Click="AddUrlIcon"/>
|
||||||
<MenuItem Header="添加系统项目" Click="AddSystemIcon"/>
|
<MenuItem Header="添加系统项目" Click="AddSystemIcon"/>
|
||||||
<MenuItem Header="资源管理器菜单" Click="SystemContextMenu" Tag="{Binding}"/>
|
<MenuItem Header="资源管理器菜单" Click="SystemContextMenu" Tag="{Binding}"/>
|
||||||
<MenuItem Header="属性" Click="PropertyConfig" Tag="{Binding}"/>
|
<MenuItem Header="属性" Click="PropertyConfig" Tag="{Binding}"/>
|
||||||
</ContextMenu>
|
</ContextMenu>
|
||||||
</ListBox.Resources>
|
</ListBox.Resources>
|
||||||
|
|
||||||
<ListBox.ItemContainerStyle>
|
<ListBox.ItemContainerStyle>
|
||||||
<Style TargetType="ListBoxItem" BasedOn="{StaticResource MyListBoxItemStyle}">
|
<Style TargetType="ListBoxItem" BasedOn="{StaticResource MyListBoxItemStyle}">
|
||||||
<Setter Property="ContextMenu" Value="{StaticResource IconDialog}"/>
|
<Setter Property="ContextMenu" Value="{StaticResource IconDialog}"/>
|
||||||
</Style>
|
</Style>
|
||||||
</ListBox.ItemContainerStyle>
|
</ListBox.ItemContainerStyle>
|
||||||
|
|
||||||
<ListBox.ItemsPanel>
|
<ListBox.ItemsPanel>
|
||||||
<ItemsPanelTemplate>
|
<ItemsPanelTemplate>
|
||||||
<StackPanel Background="#00FFFFFF"
|
<StackPanel Background="#00FFFFFF"
|
||||||
Width="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.MenuCardWidth, Mode=OneWay, Converter={StaticResource SearchResWidth}, ConverterParameter=1}"
|
Width="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.MenuCardWidth, Mode=OneWay, Converter={StaticResource SearchResWidth}, ConverterParameter=1}"
|
||||||
/>
|
/>
|
||||||
</ItemsPanelTemplate>
|
</ItemsPanelTemplate>
|
||||||
</ListBox.ItemsPanel>
|
</ListBox.ItemsPanel>
|
||||||
|
|
||||||
<ListBox.ItemTemplate>
|
<ListBox.ItemTemplate>
|
||||||
<DataTemplate>
|
<DataTemplate>
|
||||||
<WrapPanel Tag="{Binding}"
|
<WrapPanel Tag="{Binding}"
|
||||||
Height="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.ImageHeight, Mode=OneWay}"
|
Height="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.ImageHeight, Mode=OneWay}"
|
||||||
Width="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.MenuCardWidth, Mode=OneWay, Converter={StaticResource SearchResWidth}, ConverterParameter=2}"
|
Width="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.MenuCardWidth, Mode=OneWay, Converter={StaticResource SearchResWidth}, ConverterParameter=2}"
|
||||||
HorizontalAlignment="Left"
|
HorizontalAlignment="Left"
|
||||||
@@ -206,8 +222,8 @@
|
|||||||
MouseLeftButtonUp="Icon_MouseLeftButtonUp"
|
MouseLeftButtonUp="Icon_MouseLeftButtonUp"
|
||||||
Margin="25,20,0,0"
|
Margin="25,20,0,0"
|
||||||
>
|
>
|
||||||
<Image Style="{StaticResource ImageStyle}" RenderOptions.BitmapScalingMode="HighQuality"/>
|
<Image Style="{StaticResource ImageStyle}" RenderOptions.BitmapScalingMode="HighQuality"/>
|
||||||
<TextBlock
|
<TextBlock
|
||||||
Margin="10,5,0,0"
|
Margin="10,5,0,0"
|
||||||
MaxHeight="40"
|
MaxHeight="40"
|
||||||
FontSize="13"
|
FontSize="13"
|
||||||
@@ -217,10 +233,12 @@
|
|||||||
VerticalAlignment="Center"
|
VerticalAlignment="Center"
|
||||||
Foreground="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.TextColor}"
|
Foreground="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.TextColor}"
|
||||||
Text="{Binding Name}"/>
|
Text="{Binding Name}"/>
|
||||||
</WrapPanel>
|
</WrapPanel>
|
||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
</ListBox.ItemTemplate>
|
</ListBox.ItemTemplate>
|
||||||
</ListBox>
|
</ListBox>
|
||||||
|
</hc:TransitioningContentControl>
|
||||||
|
|
||||||
|
|
||||||
</WrapPanel>
|
</WrapPanel>
|
||||||
|
|
||||||
|
|||||||
@@ -603,5 +603,25 @@ namespace GeekDesk.Control.UserControls.PannelCard
|
|||||||
MainWindow.mainWindow.HidedSearchBox();
|
MainWindow.mainWindow.HidedSearchBox();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 设置光标
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
|
private void CursorPanel_MouseEnter(object sender, MouseEventArgs e)
|
||||||
|
{
|
||||||
|
this.Cursor = Cursors.Hand;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 设置光标
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
|
private void CursorPanel_MouseLeave(object sender, MouseEventArgs e)
|
||||||
|
{
|
||||||
|
this.Cursor = Cursors.Arrow;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user