binding

Problem with passing a vector as a binding to the for macro

我的未来我决定 提交于 2019-12-12 08:33:08
问题 I have an arbitrary number of lists which I would like to process using the for macro. I want to create a function that passes a vector as the binding since the number of lists varies. If I hard code the binding, it works as I expect: => (def list1 '("pink" "green")) => (def list2 '("dog" "cat")) => (for [A list1 B list2] (str A "-" B)) ("pink-dog" "pink-cat" "green-dog" "green-cat") When I try to create a vector separately and use this as the binding I hit problems. Here I manually create

WPF Binding to change fill color of ellipse

二次信任 提交于 2019-12-12 08:30:04
问题 Probably a simple question but: How do I programmatically change the color of an ellipse that is defined in XAML based on a variable? Everything I've read on binding is based on collections and lists -can't I set it simply (and literally) based on the value of a string variable? string color = "red" color = "#FF0000" 回答1: It's worth pointing out that the converter the other posts reference already exists , which is why you can do <Ellipse Fill="red"> in xaml in the first place. The converter

How can I use an ElementName binding within a ControlTemplate?

冷暖自知 提交于 2019-12-12 08:24:35
问题 I have multiple TextBlocks which reference different elements in my application. My code works fine when used directly in the page. However, I want to create a ControlTemplate and a ContentControl to reduce the duplication of code. How can I pass a reference to an ElementName into the ControlTemplate from the ContentControl using TemplateBinding? The following code throws this error: "Cannot convert the value in attribute 'ElementName' to object of type 'System.String'. Object of type 'System

WPF binding isAsync Get State

会有一股神秘感。 提交于 2019-12-12 08:11:26
问题 I am using Binding IsAsync property to keep UI responsive and loading data from the get accessor of the property and proved to be a good option while using MVVM. This approach is great and doesn't need any manual code for async operations. There are few instances where my dataload is taking few seconds and during this time it is very difficult to differentiate between "no data" vs "data loading". Is there a property which I can detect the state of the binding "IsBusy" or "Loading", so that I

WPF: Binding to ComboBox SelectedItem

浪子不回头ぞ 提交于 2019-12-12 08:05:48
问题 I have a UserControl with ComboBox that based on XML data: <Root> <Node Background="Yellow" Foreground="Cyan" Image="1.ico" Property="aaaa" Value="28" /> <Node Background="SlateBlue" Foreground="Black" Image="2.ico" Property="bbbb" Value="2.5" /> <Node Background="Teal" Foreground="Green" Image="3.ico" Property="cccc" Value="4.0" /> <Node Background="Yellow" Foreground="Red" Image="4.ico" Property="dddd" Value="0" /></Root> Here is the UserControl XAML: <UserControl x:Class="xxxxxxxx

Binding Visibility in XAML to a Visibility property

天大地大妈咪最大 提交于 2019-12-12 07:58:57
问题 I've seen on the internet quite a few examples of binding a boolean to the Visibility property of a control in XAML. Most of the good examples use a BooleanToVisibiliy converter. I'd like to just set the Visible property on the control to bind to a System.Windows.Visibility property in the code-behind, but it doesn't seem to want to work. This is my XAML: <Grid x:Name="actions" Visibility="{Binding Path=ActionsVisible, UpdateSourceTrigger=PropertyChanged}" /> This is the code for the property

Setting up binding to a custom DependencyProperty inside a WPF user control

隐身守侯 提交于 2019-12-12 07:56:08
问题 I have a WPF UserControl containing a custom DependencyProperty named MyDP. I want to bind this to a property on my ViewModel (which is injected as the UserControl's DataContext). I know one way to do it by setting the binding in the UserControl's declaration in the parent window's XAML as such: <Window x:Class="MyNamespace.Views.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:views="clr-namespace

How to suppress SLF4J Warning about multiple bindings?

我是研究僧i 提交于 2019-12-12 07:47:58
问题 My java project has dependencies with different SLF4J versions. How do I suppress the annoying warnings? SLF4J: Class path contains multiple SLF4J bindings. SLF4J: Found binding in [jar:file:xyz234/lib/slf4j- log4j12-1.5.8.jar!/org/slf4j/impl/StaticLoggerBinder.class] SLF4J: Found binding in [jar:file:xyz123/.m2/repository/org/slf4j/slf4j-log4j12 /1.6.0/slf4j-log4j12-1.6.0.jar!/org/slf4j/impl/StaticLoggerBinder.class] SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an

Static Type Binding Vs Dynamic Type Binding

梦想与她 提交于 2019-12-12 07:33:47
问题 I understand what is meant by type binding . Please correct me if I am wrong - Type binding is the process of 'associating' a declared variable to a particular type (Done by the compiler) . Type binding can be classified as - Static type binding Dynamic type binding Static type binding can be achieved by two types of declarations - http://sankofa.loc.edu/CHU/WEB/Courses/Cosi350/Ch4/bound.2.gif Its clear till here . But now , what is Dynamic type binding ? (not the definition) I know that it

Use Mvvmcross Binding with MonoTouch.Dialog (Lists and Commands)

久未见 提交于 2019-12-12 07:22:28
问题 1. Binding Lists I wonder how I could bind a ObservableCollection to a Radiogroup: new Section(){ new RootElement("Mandanten", new RadioGroup("mandanten", 2)) { new Section(){ new RadioElement("Kupus", "mandanten"), new RadioElement("Kajmak", "mandanten") } } } as you see here I'm creating 2 Items/Elements manually but I miss something like an "ItemsSource". If its not possible, what recommendation would you give me? To use witch Control (to bind Lists)? 2. CommandBinding As I see theres no