fixed some issues at design time
This commit is contained in:
1 parent
1c060d46d6
commit
3e90fca0f2
6 files changed
+23
-15
No files matched your search
@@ -343,13 +343,13 @@
|
|||||||
</hc:Transfer.ItemTemplate>
|
</hc:Transfer.ItemTemplate>
|
||||||
</hc:Transfer>
|
</hc:Transfer>
|
||||||
</Border>
|
</Border>
|
||||||
<Border Visibility="Collapsed" BorderThickness="0" Padding="16" Style="{StaticResource BorderRegion}" CornerRadius="4" Canvas.Left="611" Canvas.Top="976">
|
<Border Visibility="Visible" BorderThickness="0" Padding="16" Style="{StaticResource BorderRegion}" CornerRadius="4" Canvas.Left="611" Canvas.Top="976">
|
||||||
<userControl:CoverFlowDemoCtl Width="563" Margin="-32" Background="Transparent"/>
|
<userControl:CoverFlowDemoCtl Width="563" Margin="-32" Background="Transparent"/>
|
||||||
</Border>
|
</Border>
|
||||||
<Border Visibility="Collapsed" BorderThickness="0" Padding="16" Style="{StaticResource BorderRegion}" CornerRadius="4" Canvas.Left="1391" Canvas.Top="648" Width="274">
|
<Border Visibility="Visible" BorderThickness="0" Padding="16" Style="{StaticResource BorderRegion}" CornerRadius="4" Canvas.Left="1391" Canvas.Top="648" Width="274">
|
||||||
<userControl:ColorPickerDemoCtl Margin="-32" Background="Transparent"/>
|
<userControl:ColorPickerDemoCtl Margin="-32" Background="Transparent"/>
|
||||||
</Border>
|
</Border>
|
||||||
<Border Visibility="Collapsed" BorderThickness="0" Padding="16" Style="{StaticResource BorderRegion}" CornerRadius="4" Canvas.Left="1113" Canvas.Top="608" Width="264" Height="126">
|
<Border Visibility="Visible" BorderThickness="0" Padding="16" Style="{StaticResource BorderRegion}" CornerRadius="4" Canvas.Left="1113" Canvas.Top="608" Width="264" Height="126">
|
||||||
<hc:TagPanel Orientation="Horizontal" MaxWidth="400" VerticalAlignment="Center">
|
<hc:TagPanel Orientation="Horizontal" MaxWidth="400" VerticalAlignment="Center">
|
||||||
<hc:Tag ShowCloseButton="False" Content="TextText"/>
|
<hc:Tag ShowCloseButton="False" Content="TextText"/>
|
||||||
<hc:Tag Content="Text"/>
|
<hc:Tag Content="Text"/>
|
||||||
|
|||||||
@@ -478,7 +478,7 @@ namespace HandyControl.Controls
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private void UpdateStatus(Color color)
|
private void UpdateStatus(Color color)
|
||||||
{
|
{
|
||||||
if (_isOnDragging) return;
|
if (_isOnDragging || _sliderColor == null) return;
|
||||||
|
|
||||||
var r = color.R;
|
var r = color.R;
|
||||||
var g = color.G;
|
var g = color.G;
|
||||||
|
|||||||
@@ -204,7 +204,7 @@ namespace HandyControl.Controls
|
|||||||
/// <param name="pos"></param>
|
/// <param name="pos"></param>
|
||||||
private void Remove(int pos)
|
private void Remove(int pos)
|
||||||
{
|
{
|
||||||
var item = _itemShowList[pos];
|
if (!_itemShowList.TryGetValue(pos, out var item)) return;
|
||||||
_visualParent.Children.Remove(item);
|
_visualParent.Children.Remove(item);
|
||||||
_itemShowList.Remove(pos);
|
_itemShowList.Remove(pos);
|
||||||
}
|
}
|
||||||
@@ -308,10 +308,17 @@ namespace HandyControl.Controls
|
|||||||
{
|
{
|
||||||
if (content is Uri uri)
|
if (content is Uri uri)
|
||||||
{
|
{
|
||||||
return new CoverFlowItem(index, PageIndex, new Image
|
try
|
||||||
{
|
{
|
||||||
Source = BitmapFrame.Create(uri)
|
return new CoverFlowItem(index, PageIndex, new Image
|
||||||
});
|
{
|
||||||
|
Source = BitmapFrame.Create(uri, BitmapCreateOptions.DelayCreation, BitmapCacheOption.OnDemand)
|
||||||
|
});
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
return new CoverFlowItem(index, PageIndex, new ContentControl());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return new CoverFlowItem(index, PageIndex, new ContentControl
|
return new CoverFlowItem(index, PageIndex, new ContentControl
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ namespace HandyControl.Controls
|
|||||||
_itemsControl = GetTemplateChild(ElementItemsControl) as ItemsPresenter;
|
_itemsControl = GetTemplateChild(ElementItemsControl) as ItemsPresenter;
|
||||||
_panelPage = GetTemplateChild(ElementPanelPage) as Panel;
|
_panelPage = GetTemplateChild(ElementPanelPage) as Panel;
|
||||||
|
|
||||||
CheckNull();
|
if (!CheckNull()) return;
|
||||||
|
|
||||||
_panelPage.AddHandler(ButtonBase.ClickEvent, new RoutedEventHandler(ButtonPages_OnClick));
|
_panelPage.AddHandler(ButtonBase.ClickEvent, new RoutedEventHandler(ButtonPages_OnClick));
|
||||||
_appliedTemplate = true;
|
_appliedTemplate = true;
|
||||||
@@ -74,10 +74,7 @@ namespace HandyControl.Controls
|
|||||||
UpdatePageButtons(_pageIndex);
|
UpdatePageButtons(_pageIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void CheckNull()
|
private bool CheckNull() => !(_itemsControl == null || _panelPage == null);
|
||||||
{
|
|
||||||
if (_itemsControl == null || _panelPage == null) throw new Exception();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static readonly DependencyProperty AutoRunProperty = DependencyProperty.Register(
|
public static readonly DependencyProperty AutoRunProperty = DependencyProperty.Register(
|
||||||
"AutoRun", typeof(bool), typeof(Carousel), new PropertyMetadata(ValueBoxes.FalseBox, (o, args) =>
|
"AutoRun", typeof(bool), typeof(Carousel), new PropertyMetadata(ValueBoxes.FalseBox, (o, args) =>
|
||||||
@@ -195,6 +192,7 @@ namespace HandyControl.Controls
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public void UpdatePageButtons(int index = -1)
|
public void UpdatePageButtons(int index = -1)
|
||||||
{
|
{
|
||||||
|
if (!CheckNull()) return;
|
||||||
if (!_appliedTemplate) return;
|
if (!_appliedTemplate) return;
|
||||||
|
|
||||||
var count = Items.Count;
|
var count = Items.Count;
|
||||||
@@ -236,6 +234,7 @@ namespace HandyControl.Controls
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private void UpdateItemsPosition()
|
private void UpdateItemsPosition()
|
||||||
{
|
{
|
||||||
|
if (!CheckNull()) return;
|
||||||
if (!_appliedTemplate) return;
|
if (!_appliedTemplate) return;
|
||||||
if (Items.Count == 0) return;
|
if (Items.Count == 0) return;
|
||||||
if (!IsCenter)
|
if (!IsCenter)
|
||||||
@@ -284,6 +283,7 @@ namespace HandyControl.Controls
|
|||||||
|
|
||||||
private void ButtonPages_OnClick(object sender, RoutedEventArgs e)
|
private void ButtonPages_OnClick(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
|
if (!CheckNull()) return;
|
||||||
if (_selectedButton != null && _selectedButton.Content is Border borderOri)
|
if (_selectedButton != null && _selectedButton.Content is Border borderOri)
|
||||||
borderOri.Background = Brushes.White;
|
borderOri.Background = Brushes.White;
|
||||||
_selectedButton = e.OriginalSource as Button;
|
_selectedButton = e.OriginalSource as Button;
|
||||||
|
|||||||
@@ -400,6 +400,7 @@ namespace HandyControl.Controls
|
|||||||
|
|
||||||
private void TimeBar_OnSizeChanged(object sender, SizeChangedEventArgs e)
|
private void TimeBar_OnSizeChanged(object sender, SizeChangedEventArgs e)
|
||||||
{
|
{
|
||||||
|
if (_canvasSpe == null) return;
|
||||||
_speBlockList.Clear();
|
_speBlockList.Clear();
|
||||||
_canvasSpe.Children.Clear();
|
_canvasSpe.Children.Clear();
|
||||||
|
|
||||||
@@ -442,7 +443,7 @@ namespace HandyControl.Controls
|
|||||||
{
|
{
|
||||||
var p = Mouse.GetPosition(this);
|
var p = Mouse.GetPosition(this);
|
||||||
var mlliseconds = (p.X - ActualWidth / 2) / _itemWidth * _timeSpeList[_speIndex];
|
var mlliseconds = (p.X - ActualWidth / 2) / _itemWidth * _timeSpeList[_speIndex];
|
||||||
if (double.IsInfinity(mlliseconds)) return;
|
if (double.IsNaN(mlliseconds) || double.IsInfinity(mlliseconds)) return;
|
||||||
_textBlockMove.Text = mlliseconds < 0
|
_textBlockMove.Text = mlliseconds < 0
|
||||||
? (SelectedTime - TimeSpan.FromMilliseconds(-mlliseconds)).ToString(TimeFormat)
|
? (SelectedTime - TimeSpan.FromMilliseconds(-mlliseconds)).ToString(TimeFormat)
|
||||||
: (SelectedTime + TimeSpan.FromMilliseconds(mlliseconds)).ToString(TimeFormat);
|
: (SelectedTime + TimeSpan.FromMilliseconds(mlliseconds)).ToString(TimeFormat);
|
||||||
|
|||||||
@@ -87,7 +87,7 @@
|
|||||||
</TransformGroup>
|
</TransformGroup>
|
||||||
</ContentPresenter.RenderTransform>
|
</ContentPresenter.RenderTransform>
|
||||||
</ContentPresenter>
|
</ContentPresenter>
|
||||||
<ContentPresenter x:Name="CurrentContentPresentationSite" Content="{x:Null}" ContentTemplate="{TemplateBinding ContentTemplate}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}">
|
<ContentPresenter x:Name="CurrentContentPresentationSite" ContentTemplate="{TemplateBinding ContentTemplate}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}">
|
||||||
<ContentPresenter.RenderTransform>
|
<ContentPresenter.RenderTransform>
|
||||||
<TransformGroup>
|
<TransformGroup>
|
||||||
<ScaleTransform />
|
<ScaleTransform />
|
||||||
|
|||||||
Reference in new issue
Block a user