Merge branch 'irihitech:main' into Fix-TimeBox
This commit is contained in:
@@ -9,5 +9,6 @@
|
|||||||
x:Class="Ursa.Demo.Dialogs.PlainDialog">
|
x:Class="Ursa.Demo.Dialogs.PlainDialog">
|
||||||
<StackPanel>
|
<StackPanel>
|
||||||
<Calendar SelectedDate="{Binding Date}" ></Calendar>
|
<Calendar SelectedDate="{Binding Date}" ></Calendar>
|
||||||
|
<TextBlock TextWrapping="Wrap" Text="{Binding Text}"></TextBlock>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</UserControl>
|
</UserControl>
|
||||||
|
|||||||
@@ -12,4 +12,17 @@ public class PlainDialogViewModel: ObservableObject
|
|||||||
get => _date;
|
get => _date;
|
||||||
set => SetProperty(ref _date, value);
|
set => SetProperty(ref _date, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private string? _text;
|
||||||
|
public string? Text
|
||||||
|
{
|
||||||
|
get => _text;
|
||||||
|
set => SetProperty(ref _text, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public PlainDialogViewModel()
|
||||||
|
{
|
||||||
|
Text =
|
||||||
|
"千古悠悠 有多少冤魂嗟叹 空怅望人寰无限 丛生哀怨 泣血蝇虫笑苍天 孤帆叠影锁白链 残月升骤起烈烈风 尽吹散 尽吹散 尽吹散 滂沱雨无底涧 涉激流登彼岸 奋力拨云间消得雾患 社稷安抚臣子心 长驱鬼魅不休战 看斜阳照大地阡陌 从头转";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -14,6 +14,7 @@ public partial class SelectionListDemoViewModel: ObservableObject
|
|||||||
{
|
{
|
||||||
"Ding", "Otter", "Husky", "Mr. 17", "Cass"
|
"Ding", "Otter", "Husky", "Mr. 17", "Cass"
|
||||||
};
|
};
|
||||||
|
SelectedItem = Items[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Clear()
|
public void Clear()
|
||||||
|
|||||||
@@ -22,6 +22,8 @@ public partial class OverlayDialogHost
|
|||||||
SetTop(control, 0);
|
SetTop(control, 0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
control.MaxWidth = newSize.Width;
|
||||||
|
control.MaxHeight = newSize.Height;
|
||||||
var width = newSize.Width - control.Bounds.Width;
|
var width = newSize.Width - control.Bounds.Width;
|
||||||
var height = newSize.Height - control.Bounds.Height;
|
var height = newSize.Height - control.Bounds.Height;
|
||||||
var newLeft = width * control.HorizontalOffsetRatio??0;
|
var newLeft = width * control.HorizontalOffsetRatio??0;
|
||||||
@@ -97,6 +99,8 @@ public partial class OverlayDialogHost
|
|||||||
control.Width = Bounds.Width;
|
control.Width = Bounds.Width;
|
||||||
control.Height = Bounds.Height;
|
control.Height = Bounds.Height;
|
||||||
}
|
}
|
||||||
|
control.MaxWidth = Bounds.Width;
|
||||||
|
control.MaxHeight = Bounds.Height;
|
||||||
control.Measure(this.Bounds.Size);
|
control.Measure(this.Bounds.Size);
|
||||||
control.Arrange(new Rect(control.DesiredSize));
|
control.Arrange(new Rect(control.DesiredSize));
|
||||||
SetToPosition(control);
|
SetToPosition(control);
|
||||||
@@ -154,6 +158,8 @@ public partial class OverlayDialogHost
|
|||||||
control.Width = Bounds.Width;
|
control.Width = Bounds.Width;
|
||||||
control.Height = Bounds.Height;
|
control.Height = Bounds.Height;
|
||||||
}
|
}
|
||||||
|
control.MaxWidth = Bounds.Width;
|
||||||
|
control.MaxHeight = Bounds.Height;
|
||||||
control.Measure(this.Bounds.Size);
|
control.Measure(this.Bounds.Size);
|
||||||
control.Arrange(new Rect(control.DesiredSize));
|
control.Arrange(new Rect(control.DesiredSize));
|
||||||
SetToPosition(control);
|
SetToPosition(control);
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ using Avalonia.Controls.Primitives;
|
|||||||
using Avalonia.Controls.Selection;
|
using Avalonia.Controls.Selection;
|
||||||
using Avalonia.Controls.Templates;
|
using Avalonia.Controls.Templates;
|
||||||
using Avalonia.Input;
|
using Avalonia.Input;
|
||||||
|
using Avalonia.Interactivity;
|
||||||
using Avalonia.Rendering.Composition;
|
using Avalonia.Rendering.Composition;
|
||||||
using Avalonia.Rendering.Composition.Animations;
|
using Avalonia.Rendering.Composition.Animations;
|
||||||
using Irihi.Avalonia.Shared.Helpers;
|
using Irihi.Avalonia.Shared.Helpers;
|
||||||
@@ -95,6 +96,18 @@ public class SelectionList: SelectingItemsControl
|
|||||||
EnsureIndicatorAnimation();
|
EnsureIndicatorAnimation();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override void OnLoaded(RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
base.OnLoaded(e);
|
||||||
|
if(_indicator is not null && SelectedItem is not null)
|
||||||
|
{
|
||||||
|
var container = ContainerFromItem(SelectedItem);
|
||||||
|
if (container is null) return;
|
||||||
|
_indicator.Opacity = 1;
|
||||||
|
_indicator.Arrange(container.Bounds);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void EnsureIndicatorAnimation()
|
private void EnsureIndicatorAnimation()
|
||||||
{
|
{
|
||||||
if (_indicator is not null)
|
if (_indicator is not null)
|
||||||
|
|||||||
Reference in New Issue
Block a user