fixed a bug of CoverView

This commit is contained in:
NaBian committed 2019-02-12 10:23:20 +08:00
1 parent ab6e2efe21
commit b179d90aa1
6 files changed
+12 -11

No files matched your search

@@ -182,6 +182,7 @@ namespace HandyControl.Controls
_viewContent.ManualHeight = 0; _viewContent.ManualHeight = 0;
if (_viewContent.Content is FrameworkElement element) if (_viewContent.Content is FrameworkElement element)
{ {
element.VerticalAlignment = VerticalAlignment.Top;
element.Arrange(new Rect(new Size(double.MaxValue, double.MaxValue))); element.Arrange(new Rect(new Size(double.MaxValue, double.MaxValue)));
_viewContent.ManualHeight = element.ActualHeight; _viewContent.ManualHeight = element.ActualHeight;
} }
@@ -38,7 +38,7 @@
</TransformGroup> </TransformGroup>
</Border.RenderTransform> </Border.RenderTransform>
</Border> </Border>
<Border x:Name="PART_Content" Height="0" Grid.Row="1" Background="{TemplateBinding Background}" BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{TemplateBinding BorderBrush}"> <Border x:Name="PART_Content" MinHeight="30" Height="0" Grid.Row="1" Background="{TemplateBinding Background}" BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{TemplateBinding BorderBrush}">
<ContentPresenter Margin="{TemplateBinding Padding}"/> <ContentPresenter Margin="{TemplateBinding Padding}"/>
</Border> </Border>
<Rectangle SnapsToDevicePixels="True" Visibility="{Binding Visibility,ElementName=PART_Triangle}" Grid.Row="1" VerticalAlignment="Top" HorizontalAlignment="Left" Width="28" Margin="{Binding Margin,ElementName=PART_Triangle}" Height="1" Fill="{TemplateBinding Background}"> <Rectangle SnapsToDevicePixels="True" Visibility="{Binding Visibility,ElementName=PART_Triangle}" Grid.Row="1" VerticalAlignment="Top" HorizontalAlignment="Left" Width="28" Margin="{Binding Margin,ElementName=PART_Triangle}" Height="1" Fill="{TemplateBinding Background}">
@@ -4,7 +4,6 @@ using System.Diagnostics;
using System.IO; using System.IO;
using System.Media; using System.Media;
using System.Windows; using System.Windows;
using System.Windows.Controls;
using System.Windows.Input; using System.Windows.Input;
using System.Windows.Media.Imaging; using System.Windows.Media.Imaging;
using GalaSoft.MvvmLight; using GalaSoft.MvvmLight;
@@ -21,7 +20,7 @@ namespace HandyControlDemo.ViewModel
{ {
public class ChatBoxViewModel : ViewModelBase public class ChatBoxViewModel : ViewModelBase
{ {
private static readonly string AutioCachePath = $"{AppDomain.CurrentDomain.BaseDirectory}Cache"; private static readonly string AudioCachePath = $"{AppDomain.CurrentDomain.BaseDirectory}Cache";
private readonly string _id = Guid.NewGuid().ToString(); private readonly string _id = Guid.NewGuid().ToString();
@@ -113,11 +112,11 @@ namespace HandyControlDemo.ViewModel
private void StopRecord() private void StopRecord()
{ {
if (!Directory.Exists(AutioCachePath)) if (!Directory.Exists(AudioCachePath))
{ {
try try
{ {
Directory.CreateDirectory(AutioCachePath); Directory.CreateDirectory(AudioCachePath);
} }
catch (Exception e) catch (Exception e)
{ {
@@ -126,7 +125,7 @@ namespace HandyControlDemo.ViewModel
} }
} }
var cachePath = $"{AutioCachePath}\\{Guid.NewGuid().ToString()}"; var cachePath = $"{AudioCachePath}\\{Guid.NewGuid().ToString()}";
ExternDllHelper.MciSendString("stop movie", "", 0, 0); ExternDllHelper.MciSendString("stop movie", "", 0, 0);
ExternDllHelper.MciSendString($"save movie {cachePath}", "", 0, 0); ExternDllHelper.MciSendString($"save movie {cachePath}", "", 0, 0);
ExternDllHelper.MciSendString("close movie", "", 0, 0); ExternDllHelper.MciSendString("close movie", "", 0, 0);
@@ -20,7 +20,7 @@ namespace HandyControlDemo.ViewModel
{ {
public class ChatBoxViewModel : ViewModelBase public class ChatBoxViewModel : ViewModelBase
{ {
private static readonly string AutioCachePath = $"{AppDomain.CurrentDomain.BaseDirectory}Cache"; private static readonly string AudioCachePath = $"{AppDomain.CurrentDomain.BaseDirectory}Cache";
private readonly string _id = Guid.NewGuid().ToString(); private readonly string _id = Guid.NewGuid().ToString();
@@ -112,11 +112,11 @@ namespace HandyControlDemo.ViewModel
private void StopRecord() private void StopRecord()
{ {
if (!Directory.Exists(AutioCachePath)) if (!Directory.Exists(AudioCachePath))
{ {
try try
{ {
Directory.CreateDirectory(AutioCachePath); Directory.CreateDirectory(AudioCachePath);
} }
catch (Exception e) catch (Exception e)
{ {
@@ -125,7 +125,7 @@ namespace HandyControlDemo.ViewModel
} }
} }
var cachePath = $"{AutioCachePath}\\{Guid.NewGuid().ToString()}"; var cachePath = $"{AudioCachePath}\\{Guid.NewGuid().ToString()}";
ExternDllHelper.MciSendString("stop movie", "", 0, 0); ExternDllHelper.MciSendString("stop movie", "", 0, 0);
ExternDllHelper.MciSendString($"save movie {cachePath}", "", 0, 0); ExternDllHelper.MciSendString($"save movie {cachePath}", "", 0, 0);
ExternDllHelper.MciSendString("close movie", "", 0, 0); ExternDllHelper.MciSendString("close movie", "", 0, 0);
@@ -182,6 +182,7 @@ namespace HandyControl.Controls
_viewContent.ManualHeight = 0; _viewContent.ManualHeight = 0;
if (_viewContent.Content is FrameworkElement element) if (_viewContent.Content is FrameworkElement element)
{ {
element.VerticalAlignment = VerticalAlignment.Top;
element.Arrange(new Rect(new Size(double.MaxValue, double.MaxValue))); element.Arrange(new Rect(new Size(double.MaxValue, double.MaxValue)));
_viewContent.ManualHeight = element.ActualHeight; _viewContent.ManualHeight = element.ActualHeight;
} }
@@ -38,7 +38,7 @@
</TransformGroup> </TransformGroup>
</Border.RenderTransform> </Border.RenderTransform>
</Border> </Border>
<Border x:Name="PART_Content" Height="0" Grid.Row="1" Background="{TemplateBinding Background}" BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{TemplateBinding BorderBrush}"> <Border x:Name="PART_Content" MinHeight="30" Height="0" Grid.Row="1" Background="{TemplateBinding Background}" BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{TemplateBinding BorderBrush}">
<ContentPresenter Margin="{TemplateBinding Padding}"/> <ContentPresenter Margin="{TemplateBinding Padding}"/>
</Border> </Border>
<Rectangle SnapsToDevicePixels="True" Visibility="{Binding Visibility,ElementName=PART_Triangle}" Grid.Row="1" VerticalAlignment="Top" HorizontalAlignment="Left" Width="28" Margin="{Binding Margin,ElementName=PART_Triangle}" Height="1" Fill="{TemplateBinding Background}"> <Rectangle SnapsToDevicePixels="True" Visibility="{Binding Visibility,ElementName=PART_Triangle}" Grid.Row="1" VerticalAlignment="Top" HorizontalAlignment="Left" Width="28" Margin="{Binding Margin,ElementName=PART_Triangle}" Height="1" Fill="{TemplateBinding Background}">