@ -33,7 +33,7 @@ placed in a `DataTemplates` collection on each control (and on `Application`):
<TextBox Text="{Binding Name}"/>
</Border>
</DataTemplate>
</UserControl.Styles>
</UserControl.DataTemplates>
<!-- Assuming that DataContext.Foo is an object of type
MyApp.ViewModels.FooViewModel then a red border with a corner
radius of 8 containing a TextBox will be displayed here -->
@ -41,7 +41,7 @@ namespace Avalonia.Gtk3.Interop
class GtkWindow : GtkWidget
{
public static GtkWindow Null { get; } = new GtkWindow();
}
class GtkImContext : GObject
@ -11,6 +11,8 @@ namespace Avalonia.Gtk3.Interop
public Utf8Buffer(string s) : base(IntPtr.Zero, true)
if (s == null)
return;
_data = Encoding.UTF8.GetBytes(s);
_gchandle = GCHandle.Alloc(_data, GCHandleType.Pinned);
handle = _gchandle.AddrOfPinnedObject();
@ -18,7 +18,8 @@ namespace Avalonia.Gtk3
bool multiselect, string initialFileName)
GtkFileChooser dlg;
using (var name = title != null ? new Utf8Buffer(title) : null)
parent = parent ?? GtkWindow.Null;
using (var name = new Utf8Buffer(title))
dlg = Native.GtkFileChooserDialogNew(name, parent, action, IntPtr.Zero);
if (multiselect)
Native.GtkFileChooserSetSelectMultiple(dlg, true);