Hi all,
I have custom control with some text in content template:
<ControlTemplate TargetType="{x:Type local:TouchScreenKey}">
<TextBlock><ContentPresenter Content="{TemplateBinding Title, Converter={StaticResource CaseConverter}}" /></TextBlock>
</ControlTemplate>
and custom IValueConverter CaseConverter - with property Upper...
Two function should be implemented, and I am wondering what type of validation I need to do on inputs and how to manage errors.
Public Function Convert(ByVal value As Object, ByVal targetType As System.Type, ByVal parameter As Object, ByVal culture As System.Globalization.CultureInfo) As Object Implements System.Windows.Data.IValueConve...
I have a WPF UI that is bound to an object. I'm using a ValueConverter to convert a property to a specific image by a business rule:
public class ProposalStateImageConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
var proposal...
I've got a situation in which I need to show an integer value, bound to a property on my data context, after putting it through two separate conversions:
Reverse the value within a range (e.g. range is 1 to 100; value in datacontext is 90; user sees value of 10)
convert the number to a string
I realise I could do both steps by creati...
hi there,
i´m currently facing a problem where i have to set properties on a bunch of framework elements depending on some other properties. i wonder how triggers and converters compare when it comes to performance.
Especially MultiTriggers and IMultiValueConverters.
Is there any difference? google wasn't helpful so i thought maybe so...
I am using Telerik RadGridView in my project. I want to show image in column.
GridViewImageColumn col1 = new GridViewImageColumn();
col1.Width = 100;
col1.DataMemberBinding = new Binding("id");
col1.Header = "PhotoByConverter";
col1.DataMemberBinding.Conver...
I have an extremely simple IMultiValueConverter that simply OR's two values. In the example below, I want to invert the first value using an equally simple boolean inverter.
<MultiBinding Converter="{StaticResource multiBoolToVis}">
<Binding Path="ConditionA" Converter="{StaticResource boolInverter}"/>
<Binding Path="ConditionB"...
Hi,
I am not sure Why we need to use I ConvertBack method in IValueConverter.
In the Convert method itself we do the conversion and return the updated value to be bound in our control.
So in which Scenario we should use Convertback. I know this question is very basic but just wanted to make the fundamentals clear.
Thanks a lot for you...
I'm playing around with WPF and databinding and I'm wondering about the following.
I defined a few PropertyGroupDescriptions, but now I'm wondering how to read the PropertyName from an IValueConverter.
Is this possible?
...
Hi-
I'm trying to use a MultiBinding with a converter where the child elements also have a converter.
The XAML looks like so:
<TextBlock>
<TextBlock.Text>
<MultiBinding Converter="{StaticResource localizedMessageConverter}" ConverterParameter="{x:Static res:Resources.RecordsFound}" >
<Binding Converter="{StaticResource lo...
<Canvas.DataContext>
<ViewModels:VMSomeControl Model="{Binding RelativeSource={RelativeSource TemplatedParent}}" />
</Canvas.DataContext>
<!-- DataContext is not passed into these Instances.
they also have no knowledge of their TemplatedParent. -->
<Canvas.Resources>
<!-- is there a way to use a binding t...
I'm going through some silverlight apps and reviewing date formatting to make sure the presentation is appropriate for the viewer.
with an implementation of IValueConverter, where does the culture parameter come from in the Convert/ConvertBack functions? it seems to not be CultureInfo.CurrentCulture which I think is what I want.
...
Hi,
I have a problem with a databinding in WPF.
When I try to use a value converter and set the NotifyOnTargetUpdated=True property to True, I get an XamlParseException with the following message:
'System.Windows.Data.BindingExpression'
value cannot be assigned to property
'Contenu' of object
'View.UserControls.ShadowedText'....
What is the difference between using a Converter (IValueConverter) and passing in other values as parameters (ConverterParameter) vs using a MultiConverter (IMultiValueConverter) and just passing in multiple converter values?
...
What are the recommended uses of IValueConverter? I've used it for things like converting a boolean property to a Visibility property but I'm wondering how far you should take it? Is it supposed to be only used to change representations of common types to UI specific types (bool to Visibility for example).
E.g., if I have a property i...
I want to compare two versions of various properties and bold one of them if it is not equal to the other. Since SL4 doesn't support MultiBinding I am binding the FontWeight to "." so that the entire data context is passed to the converter. I then use the converter parameter to specify which fields to compare within the converter. So f...
Is there a way to use the existing WPF BooleanToVisibilityConverter converter but have False values convert to Hidden instead of the default Collapsed, or should I just write my own? I'm on a project where it's tremendous overhead to do something simple like this (shared stuff goes into a separate solution, and the rebuild/checkin/merge...
let's say we are using IValueConverter to format a GridView cell background color depending on its value.
now let's say that value is calculated on a separate thread, after adding the item to the collection.
var args = GetInput();
if (ValidateArgs(args))
{
if (args.Rate.HasValue)
Thre...
I bind a collection ObservableCollection<Foo> to a dependency property on my controller, but I run it through an IValueConverter to make it ObservableCollection<object> instead, which is what my controller expect. The conversion works fine - I create an ObservableCollection<object> and fill it with all the Foo's from the original list. T...
I have to format a string ("00:10:08:10") into (10 weeks 08 days 10 hrs). So I used a converter and added it with the datagrid binding. My code:
Public Function Convert(ByVal value As Object, ByVal targetType As System.Type, ByVal parameter As Object, ByVal culture As System.Globalization.CultureInfo) As Object Implements System.Wind...