Update
This commit is contained in:
Родитель
8ee62c9aeb
Коммит
72b89953f5
|
@ -7,7 +7,7 @@
|
|||
<IsPackable>True</IsPackable>
|
||||
<AnalysisLevel>latest</AnalysisLevel>
|
||||
<LangVersion>latest</LangVersion>
|
||||
<AvaloniaVersion>0.10.19</AvaloniaVersion>
|
||||
<AvaloniaVersion>11.0.0-preview8</AvaloniaVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
|
|
|
@ -41,25 +41,21 @@ namespace Avalonia.Controls.VariableSizedWrapGrid
|
|||
|
||||
public static int GetColumnSpan(Control element)
|
||||
{
|
||||
Contract.Requires<ArgumentNullException>(element != null);
|
||||
return element!.GetValue(ColumnSpanProperty);
|
||||
}
|
||||
|
||||
public static void SetColumnSpan(Control element, int value)
|
||||
{
|
||||
Contract.Requires<ArgumentNullException>(element != null);
|
||||
element!.SetValue(ColumnSpanProperty, value);
|
||||
}
|
||||
|
||||
public static int GetRowSpan(Control element)
|
||||
{
|
||||
Contract.Requires<ArgumentNullException>(element != null);
|
||||
return element!.GetValue(RowSpanProperty);
|
||||
}
|
||||
|
||||
public static void SetRowSpan(Control element, int value)
|
||||
{
|
||||
Contract.Requires<ArgumentNullException>(element != null);
|
||||
element!.SetValue(RowSpanProperty, value);
|
||||
}
|
||||
|
||||
|
@ -530,7 +526,7 @@ namespace Avalonia.Controls.VariableSizedWrapGrid
|
|||
|
||||
bool ILogicalScrollable.IsLogicalScrollEnabled => true;
|
||||
|
||||
event EventHandler ILogicalScrollable.ScrollInvalidated
|
||||
event EventHandler? ILogicalScrollable.ScrollInvalidated
|
||||
{
|
||||
add => _scrollInvalidated += value;
|
||||
remove => _scrollInvalidated -= value;
|
||||
|
@ -540,14 +536,14 @@ namespace Avalonia.Controls.VariableSizedWrapGrid
|
|||
|
||||
Size ILogicalScrollable.PageScrollSize => new Size(16, 16);
|
||||
|
||||
bool ILogicalScrollable.BringIntoView(IControl target, Rect targetRect)
|
||||
bool ILogicalScrollable.BringIntoView(Control target, Rect targetRect)
|
||||
{
|
||||
if (targetRect.IsEmpty)
|
||||
if (targetRect == default)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
targetRect = targetRect.TransformToAABB(target.TransformToVisual(this).Value);
|
||||
targetRect = targetRect.TransformToAABB(target.TransformToVisual(this)!.Value);
|
||||
|
||||
Rect viewRect = new Rect(_offset.X, _offset.Y, _viewport.Width, _viewport.Height);
|
||||
|
||||
|
@ -576,10 +572,10 @@ namespace Avalonia.Controls.VariableSizedWrapGrid
|
|||
|
||||
targetRect.Intersect(viewRect);
|
||||
|
||||
return !targetRect.IsEmpty;
|
||||
return targetRect != default;
|
||||
}
|
||||
|
||||
IControl ILogicalScrollable.GetControlInDirection(NavigationDirection direction, IControl from)
|
||||
Control? ILogicalScrollable.GetControlInDirection(NavigationDirection direction, Control? from)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
<Application xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
x:Class="AvaloniaSample.App">
|
||||
x:Class="AvaloniaSample.App"
|
||||
Name="AvaloniaSample"
|
||||
RequestedThemeVariant="Light">
|
||||
<Application.Styles>
|
||||
<StyleInclude Source="avares://Avalonia.Themes.Default/DefaultTheme.xaml"/>
|
||||
<StyleInclude Source="avares://Avalonia.Themes.Default/Accents/BaseLight.xaml"/>
|
||||
<FluentTheme />
|
||||
</Application.Styles>
|
||||
</Application>
|
||||
</Application>
|
||||
|
|
|
@ -6,11 +6,12 @@
|
|||
<LangVersion>preview</LangVersion>
|
||||
<Nullable>enable</Nullable>
|
||||
<IsPackable>False</IsPackable>
|
||||
<AvaloniaVersion>0.10.19</AvaloniaVersion>
|
||||
<AvaloniaVersion>11.0.0-preview8</AvaloniaVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Avalonia" Version="$(AvaloniaVersion)" />
|
||||
<PackageReference Include="Avalonia.Themes.Fluent" Version="$(AvaloniaVersion)" />
|
||||
<PackageReference Include="Avalonia.Desktop" Version="$(AvaloniaVersion)" />
|
||||
<PackageReference Include="Avalonia.ReactiveUI" Version="$(AvaloniaVersion)" />
|
||||
<PackageReference Include="Avalonia.Diagnostics" Version="$(AvaloniaVersion)" />
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
x:Class="AvaloniaSample.MainWindow"
|
||||
Title="MainWindow"
|
||||
x:DataType="vm:TilePanelViewModel" x:CompileBindings="True">
|
||||
<ItemsControl Items="{Binding Tiles}"
|
||||
<ItemsControl ItemsSource="{Binding Tiles}"
|
||||
UseLayoutRounding="False"
|
||||
Background="DarkGray"
|
||||
Name="ItemsControl">
|
||||
|
@ -47,4 +47,4 @@
|
|||
<!-- <Grid Background="Black" c:VariableSizedWrapGrid.ColumnSpan="2" c:VariableSizedWrapGrid.RowSpan="2"/> -->
|
||||
</ItemsControl>
|
||||
<!-- <local:SamplesView/> -->
|
||||
</Window>
|
||||
</Window>
|
||||
|
|
|
@ -10,7 +10,7 @@ using AvaloniaSample.ViewModels;
|
|||
|
||||
namespace AvaloniaSample
|
||||
{
|
||||
public class MainWindow : Window
|
||||
public partial class MainWindow : Window
|
||||
{
|
||||
public MainWindow()
|
||||
{
|
||||
|
@ -67,11 +67,9 @@ namespace AvaloniaSample
|
|||
}
|
||||
};
|
||||
|
||||
var itemsPanel = this.FindControl<ItemsControl>("ItemsControl");
|
||||
|
||||
double tileAspectRation = 0.5;
|
||||
|
||||
itemsPanel.GetObservable(BoundsProperty).Subscribe(x =>
|
||||
ItemsControl.GetObservable(BoundsProperty).Subscribe(x =>
|
||||
{
|
||||
var width = x.Width;
|
||||
var itemWidth = width / tilePanel.MaximumRowsOrColumns;
|
||||
|
@ -83,10 +81,5 @@ namespace AvaloniaSample
|
|||
|
||||
DataContext = tilePanel;
|
||||
}
|
||||
|
||||
private void InitializeComponent()
|
||||
{
|
||||
AvaloniaXamlLoader.Load(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,9 +23,7 @@
|
|||
HorizontalScrollBarVisibility="{TemplateBinding (ScrollViewer.HorizontalScrollBarVisibility)}"
|
||||
VerticalScrollBarVisibility="{TemplateBinding (ScrollViewer.VerticalScrollBarVisibility)}">
|
||||
<ItemsPresenter Name="PART_ItemsPresenter"
|
||||
Items="{TemplateBinding Items}"
|
||||
ItemsPanel="{TemplateBinding ItemsPanel}"
|
||||
ItemTemplate="{TemplateBinding ItemTemplate}"/>
|
||||
ItemsPanel="{TemplateBinding ItemsPanel}"/>
|
||||
</ScrollViewer>
|
||||
</Border>
|
||||
</ControlTemplate>
|
||||
|
@ -55,7 +53,7 @@
|
|||
</ItemsControl>
|
||||
</TabItem>
|
||||
<TabItem Header="Colors">
|
||||
<ItemsControl Classes="vswg" Items="{Binding}" Background="DarkGray">
|
||||
<ItemsControl Classes="vswg" ItemsSource="{Binding}" Background="DarkGray">
|
||||
<ItemsControl.Styles>
|
||||
<Style Selector="ItemsControl > ContentPresenter">
|
||||
<Setter Property="Margin" Value="0,0,4,4" />
|
||||
|
|
|
@ -5,7 +5,7 @@ using Avalonia.Media;
|
|||
|
||||
namespace AvaloniaSample
|
||||
{
|
||||
public class SamplesView : UserControl
|
||||
public partial class SamplesView : UserControl
|
||||
{
|
||||
public SamplesView()
|
||||
{
|
||||
|
@ -14,11 +14,6 @@ namespace AvaloniaSample
|
|||
InitColors();
|
||||
}
|
||||
|
||||
private void InitializeComponent()
|
||||
{
|
||||
AvaloniaXamlLoader.Load(this);
|
||||
}
|
||||
|
||||
private void InitColors()
|
||||
{
|
||||
var colors = typeof(Colors)
|
||||
|
@ -59,4 +54,4 @@ namespace AvaloniaSample
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче