avaloniaui

How to extend a Control in Avalonia?

China☆狼群 提交于 2021-01-27 13:04:24
问题 I want to extend the default dropdown with some functionality. The custom dropdown should behave like a default dropdown in the .xaml file, so it should be possible to add items to it. Unfortunately, it does not seem to work like in WPF. That's my approach: MainWindow.xaml: (added the namespace) <local:myCustomDropDown> <DropDownItem>1</DropDownItem> <DropDownItem>2</DropDownItem> </local:myCustomDropDown> myCustomDropDown.xaml: <DropDown xmlns="https://github.com/avaloniaui" xmlns:x="http:/

How to extend a Control in Avalonia?

☆樱花仙子☆ 提交于 2021-01-27 12:58:45
问题 I want to extend the default dropdown with some functionality. The custom dropdown should behave like a default dropdown in the .xaml file, so it should be possible to add items to it. Unfortunately, it does not seem to work like in WPF. That's my approach: MainWindow.xaml: (added the namespace) <local:myCustomDropDown> <DropDownItem>1</DropDownItem> <DropDownItem>2</DropDownItem> </local:myCustomDropDown> myCustomDropDown.xaml: <DropDown xmlns="https://github.com/avaloniaui" xmlns:x="http:/

How to include external font in Avalonia application without installing it

无人久伴 提交于 2020-07-10 10:24:20
问题 I try to use a kind of Chinese fonts HGDH_CNKI.TTF . I put it into sbid/Assets/Fonts/ (my project name is sbid). And then I try it like this, I use: <Button Command="{Binding AddProtocol}" FontFamily="/Assets/Fonts/HGDH_CNKI.TTF#HGDH_CNKI">新协议</Button> or <Button Command="{Binding AddProtocol}" FontFamily="avares://sbid/Assets/Fonts/HGDH_CNKI.TTF#HGDH_CNKI">新协议</Button> It still doesn't work. Is there any other steps I need to do? 来源: https://stackoverflow.com/questions/62816456/how-to

DataGrid in Avalonia UI for Linux does not show up when app is running

﹥>﹥吖頭↗ 提交于 2020-05-17 08:46:19
问题 I'm running Avalonia UI on .NET Core for Linux (Fedora). I've followed this tutorial for the DataGrid, but honestly I've added the package with the following command, instead of manually updating the .csproj . dotnet add package Avalonia.Controls.DataGrid After a dotnet restore and a dotnet run , I can't see any DataGrid. Anyway xaml <StackPanel> <DataGrid AutoGenerateColumns="True" Items="{Binding People}"/> </StackPanel> and ViewModel look fine. public ObservableCollection<Person> People {

OpenFileDialog in Avalonia - Error with ShowAsync

自古美人都是妖i 提交于 2019-12-25 01:12:55
问题 Background: I have been using Avalonia to develop a cross-platform UI. To learn it I am trying to creating a simple program that opens a .txt file using OpenFileDialog and displays its contents in a ComboBox in another window. I am trying to write a method that opens file dialog and returns the path the user opened. I am using a button with a Click event to open file dialog and put the specified path in a TextBox for the user to see. Since I am new to both WPF and Avalonia, I am not sure how