binding

How to bind class properties in XAML of xamarin forms

南笙酒味 提交于 2019-12-24 00:35:43
问题 I have class given as below - public static class ColorResources { public static readonly Color ListTextColor = Color.Blue; } And any xaml file having control like - <Button Text="Create Account" TextColor="#000000" BackgroundColor="ListTextColor" Clicked="btnCreateAcc_clicked"/> Lets Say I want BackgroundColor of button which is declared in my class file. How to make this possible? 回答1: You can do this by declaring a new namespace in your XAML and use it. <ContentPage xmlns="http://xamarin

How to manually bind static Items to SplitButton (mahapps) via XAML

江枫思渺然 提交于 2019-12-24 00:34:43
问题 How do i manually add for example 2 items (buttons) from which the first is preselected via xaml? Like: <controls:SplitButton SelectedIndex="0"> <controls:SplitButton.Items> <Button Content="Button 1"/> <Button Content="Button 2"/> </controls:SplitButton.Items> </controls:SplitButton> Documentation tells me to use ItemsSource Binding but there is no example of the code behind. 回答1: This is the XAML: <controls:SplitButton x:Name="splitButton" SelectedIndex="1" HorizontalAlignment="Left"

How can I bind custom properties from View to ViewModel on code behind?

安稳与你 提交于 2019-12-24 00:34:25
问题 I made a Page MainPage and a UserControl Pager . Both have their ViewModel. In Pager , there are three dependency properties Rows , Columns , Source . I want to pass these properties from Pager 's View to Pager 's ViewModel. I tried this on View's code behind. But it doesn't work...the set property in PagerViewModel never be called on debugging. Please, help me... Here is detail mechanism: MainPageViewModel ↓Pass the values with binding MainPage ↓Set tht properties with values from

Datatemplate binding spam Output window with error: Cannot find governing FrameworkElemen

二次信任 提交于 2019-12-24 00:34:18
问题 I have problem System.Windows.Data Error: 2 : Cannot find governing FrameworkElement or FrameworkContentElement for target element. BindingExpression:(no path); DataItem=null; target element is 'SolidColorBrush' (HashCode=48519443); target property is 'Color' (type 'Color') It can be reproduced with following xaml: <Window PreviewKeyDown="Window_PreviewKeyDown" xmlns:diag="clr-namespace:System.Diagnostics;assembly=WindowsBase" ... > <Window.Resources> <DataTemplate DataType="{x:Type local

Vaadin: value from DateField is null after conversion

蓝咒 提交于 2019-12-24 00:28:42
问题 I faced with problem that I'm incapable to save typed date in the DateField to the database. I'm using Hibernate as ORM framework and there is Order entity that has java.sql.Date fields. But as far as I know DateField works only with LocalDate/LocalDateTime. So then in order to bind those fields I created Converter class. The problem was that the Converter received a null value and that's why I got a stacktrace, but the issue was solved in this thread: Vaadin DateField saves null value to

How do I make a reflection effect in WPF ? (from code)

冷暖自知 提交于 2019-12-24 00:23:47
问题 I need to have some mirror objects in WPF. I have a Canvas with some content, and I need 50 visual clones, and if I modify something on the source, it should be updated in these clones. I know it is easy to do in XAML by binding the Visual of a VisualBrush to the element, but can's seem to do this from code. Can anyone help ? 回答1: Ok, meanwhile I have found the solution (Via Sese). If anyone is interested, find it below: VisualBrush VisualBrush1 = new VisualBrush(); VisualBrush1.TileMode =

DataGrid ComboBox Binding Issue with Selected or New Item

我们两清 提交于 2019-12-24 00:08:59
问题 I am having issue with retaining selected item in a DataGridTemplate column ComboBox. I have the DataTemplate editable combobox column as the first column in the datagrid and next to it, I have a text column. The DataGrid is populated with data read from SQL stored procedure. Everything works fine, except when I select an item in the combobox and move to the text field and start typing in it, the Combo selection blanks out. It blanks out both for a new item or existing item. Oddly, this

EmberJS 2.7 - how to bind attribute 'disabled' for a button

徘徊边缘 提交于 2019-12-23 22:20:10
问题 This official guide describes how you can bind a boolean property to disabled attribute of a HTML element. Yet it talks about a controller. I have a button, that when clicked transitions the route (sorry it has to be a button and cannot be a link-to): /templates/trails.hbs <button type="button" class="btn btn-primary" disabled={{isEditing}} onclick={{route-action 'addNew'}}>Add New</button> (route-action is a helper that allows me to use closure actions in routes) /routes/trails.js import

WPF - ToolTip Binding with stringformat

这一生的挚爱 提交于 2019-12-23 22:19:59
问题 I want to make a tool tip using binding and string format, he is what I've tried: <TextBlock Text="{Binding Name}" ToolTip="{Binding Path=Name, StringFormat='The name is: {0}{}'}"/> The value of Name is : Golan What I expected to see is: The name is: Golan But all is see is: Golan 回答1: I think you can use this code <TextBlock Width="100" x:Name="tt" Text="{Binding Name}"> <TextBlock.ToolTip> <ToolTip Width="100" Content="{Binding Name}" ContentStringFormat="The Name is: {0}" /> </TextBlock

Durandal Compose: activate method not always called

自作多情 提交于 2019-12-23 21:34:36
问题 In a SPA,I have a view in which I include another view using the compose binding. This sub view (child view) has an activate method which is called when the parent view is loaded. <div data-bind="compose: 'viewmodel/fol/index'"></div> However, when I navigate away from the parent view and then go back to it (without refreshing the browser), the activate method in the child view is not longer called. How can I force this to be called each time the parent view is loaded? 回答1: Since you are not