Questions tagged [ivalueconverter]

IValueConverter is an interface defined in Microsoft .NET XAML for use in WPF, Silverlight and Xamarin.Forms. It is used in data binding to convert data from one format to another. The conversion can be one-way or bidirectional.

Filter by
Sorted by
Tagged with
-3 votes
1 answer
48 views

IValueConverter for visibility binding in WPF is never called

I want to bind the visibility property of a control in WPF to a boolean value. I wrote a Converter based on IValueConverter: namespace MyApp.Converter { using System; using System.Windows.Data;...
Konrad's user avatar
  • 4,417
0 votes
2 answers
76 views

Pass a property from an ItemsControl source class into a converter parameter

I have an ItemsControl like this <ItemsControl Name="itemsControl"> <ItemsControl.ItemTemplate> <DataTemplate> <ToggleButton Style="{...
Hans GD's user avatar
  • 52
0 votes
0 answers
34 views

Rectangle Bars are not showing up as different colors or at all

I want the bars to show as a different color based on the rating. I would also like if my convert would actual work like it is intended instead of giving me an error. My converter is not working I am ...
Kraytonian's user avatar
1 vote
1 answer
35 views

Bind IsChecked to bitfield

I have a bitfield like this: [Flags] public enum EmployeeType { None = 0, IsInOffice = 1, IsManager = 2, IsOnVacation = 4, ... } My UI has a listbox of all employees and I want to ...
acg's user avatar
  • 37
0 votes
1 answer
47 views

WPF Binding.Converter in i:InvokeCommandAction.CommandParameter can only be called once

When the Grid component size changes, I want to get its ActualWidth and ActualHeight properties so that the contents of the canvas in the Grid could be recalculated to fit. So, taking this post(https:/...
MiralKong's user avatar
0 votes
1 answer
74 views

Binding for a property of a Converter

I have a problem in Binding the value of the parameter of a class. I defined the below converter to change the values of the visual components using a unit converter class. [ValueConversion(typeof(...
Mohicode's user avatar
0 votes
1 answer
139 views

WPF IValueConverter with Radio Buttons

I have a datagrid to which a list of objects is binded. Each object has a Number property. I have 2 radio buttons,if the first is checked then the default value should appear in the column,but if the ...
nb-1999's user avatar
  • 29
0 votes
0 answers
63 views

Best practise for IValueConverter to convert two variables

I have the following XAML Code: <Silder ... Value="{Binding aValue, Converter = {StaticResource myConverter}, Mode=TwoWay}" .../> <Label ... Text="{Binding aValue, Mode=...
Brudi_Voeller's user avatar
0 votes
0 answers
32 views

Using two-way XAML Data Binding to convert a list of enum entries to a corresponding group of checkboxes

In my XAML, I have the following stackpanel containing a checkboxes for each weekday: <StackPanel> <CheckBox>Monday</CheckBox> <CheckBox>Tuesday</CheckBox> &...
kfjordt's user avatar
0 votes
1 answer
43 views

WPF XAML IValueConverter Math Trouble

I have a converter bound to a datagridcell's opactity as such: <Setter Property="Opacity" Value="{Binding Number, Converter={StaticResource OpacityConverterKey}}" /> And here ...
javaturkey's user avatar
0 votes
1 answer
290 views

WinUI 3. Dependency injection in IValueConverter, using Microsoft.Extensions.DependencyInjection

I have a WinUI 3 app where we use Dependency-Injection from Microsoft.Extensions, and settings containing DateTime the current Date-Time formatting have been registered to the service collection as ...
Hulabuli's user avatar
0 votes
1 answer
107 views

WPF VS2022 cant check if targetype is Visibility

I have a IValueConverter that converts "null" to "Visible": public class InverseNullToVisibilityConverter : IValueConverter { public object Convert(object value, Type ...
Kevin Uchiha's user avatar
1 vote
1 answer
55 views

WPF/ How can I IValueConverter Update Force

I write code for multilanguage using IValueConverter. Text will be change dynamically and so many texts has. So I cannot be make using Resource file. I decided to make using IValueConverter. And First ...
Jaeyul Park's user avatar
0 votes
0 answers
70 views

Chrome extension violates the following Content Security Policy directive: "default-src 'self' blob: filesystem: chrome-extension-resource

I'm doing currency converter chrome extension and so far I've done almost everything but the math. It ain't mathing. I have popup.js javascript file inside folder with popup.html in which I call popup....
Danijel Tomljenović's user avatar
0 votes
1 answer
111 views

XAML Designer unable to resolve Enum types, 'base.enum' to 'mocks.enum_'

I have a C#/WPF MVVM program that uses a flagged enum to track the types of search mode the user is currently in and to manipulate the background colors of various controls depending on the given ...
Zinx's user avatar
  • 1
0 votes
0 answers
39 views

Why is IValueConverter ConverterParameter not Bindable? [duplicate]

This is not a duplicate. I am asking why the ConverterParameter property is not a BindableProperty by default. Is there a reason? The post that is supposedly a duplicate of this question outlines a ...
RangerRick's user avatar
0 votes
1 answer
552 views

wpf TextBox binding stringformat + converter don't want to work together

I have custom TextBox that only accepts float as input. I bind it to float property (of custom dependency property) using two-way mode. It uses custom converter to do the string conversion to float ...
Bin03's user avatar
  • 49
0 votes
1 answer
28 views

Assigning Color Value to BackgroundColor Property from Value Converter

Using a converter (IValueConverter) to change background color a a border, but it does not assign the color value correctly to the BackgroundColor property. Converter is straight forward: numeric ...
Rob5961's user avatar
  • 21
0 votes
1 answer
78 views

Decimal point is being removed in Entry

My converter is the following public class DecimalConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { if (value ...
SarPa's user avatar
  • 35
2 votes
1 answer
232 views

Using BoolToObjectConverter with TranslateExtension True/FalseObject does not return translated string

I am using the BoolToObjectConverter from Xamarin Community Toolkit (XCT) in my XAML file. The TrueObject and FalseObject properties are set to translatable strings where I use the TranslateExtension ...
Anders Gustafsson's user avatar
-1 votes
1 answer
124 views

WPF IValueConverter not firing

I'm attempting to implement a value converter that will change the color of a button on a user control based on the custom "MyUserControlStatus" property of the user control "...
swabygw's user avatar
  • 823
0 votes
1 answer
270 views

Changing Background Color of DataGridCell via IValueConverter

I am using a WPF DataGrid with dynamic columns. The colums and binding are generated in code behind which is working fine. Now I want to change the background color of the DataGrid cell depending on ...
Baumfaust's user avatar
0 votes
1 answer
168 views

TemplateBinding with IValueConverter

I want to generate a custom button in a WPF-project. I want the button to change its background color in such a way, that the opacity is reduced. Therefore I have a resource dictionary with a default ...
nckstr15's user avatar
0 votes
1 answer
598 views

C# WPF Binding Converter not firing if bound property is null

I'm currently facing the strange issue using WPF MVVM data binding. The idea is to use ValueConverter that displays bound value if its not null, otherwise displays string defined in ConverterParameter....
kevintw's user avatar
  • 58
-1 votes
1 answer
265 views

WPF Converter: Unable to cast object of type 'System.Int32' to type 'System.Windows.Controls.ListViewItem'

In a GridViewColumn I have below converter: <GridViewColumn Header="Number" DisplayMemberBinding="{Binding (ItemsControl.AlternationIndex), ...
Willy's user avatar
  • 10k
0 votes
1 answer
216 views

Regular expression issues in .net 6 value converter

I am trying to learn some .net6 and c# and I am struggling with regular expressions a lot. More specificaly with Avalonia in Windows if that is relevant. I am trying to do a small app with 2 textboxes....
JorgeLL's user avatar
0 votes
0 answers
68 views

How to override exception message generated by IValueConverter

I would like to override message provided by the custom conversion class which inherits IValueConverter interface. public class BoolConverter : IValueConverter { public object Convert(...
veldo's user avatar
  • 1
0 votes
0 answers
33 views

How to properly compute URI from ValueConverter in WPF

I have a simple application where I want to swap out image based on a value converter. Upon testing the images shows fine when directly bound to the code behind of a user control. public partial class ...
jwize's user avatar
  • 4,226
0 votes
0 answers
170 views

IntToVisibilityConverter In WPF

I have a StackPanel and Border and what I need to achieve is whenever the Children.Count property of the panel is 0 the Border become visible. I tried to many times but don't know what's wrong with my ...
Ahmed Alayat's user avatar
0 votes
1 answer
82 views

wpf Combobox and IValueConverter

I am relatively new to WPF and keep trying out little tests to improve my Knowledge. I am currently trying to utilise a Combobox to select an item and based upon the selection, change the color of the ...
StephenH's user avatar
-2 votes
1 answer
38 views

Whis is the column not resize?

I have a datagrid and I want to set the width of a column according to some values, so I am trying to use a multibinding in this way: <DataGridTextColumn.Width> ...
Álvaro García's user avatar
2 votes
1 answer
295 views

Can I get an enum value having a given description attribute using a generic function?

I'm creating a generic filtering user control to allow the user to apply various filters on a CollectionView, on an WPF app. So, I have a filled CollectionView with entities, with properties. So, ...
Artur S.'s user avatar
  • 195
0 votes
0 answers
78 views

Path.Data binding for GridViewColumn.CellTemplate in ListView

I see Ellipses in ListView if i set Path.Data like this: <GridViewColumn Header="Shape"> <GridViewColumn.CellTemplate > <...
Stanislav Schegolkov's user avatar
0 votes
1 answer
384 views

Decouple IValueConverter (Disable/Enable a WPF Converter)

It's a way to enable and disable a WPF Converter? Either programmatically or directly from WPF binding a checkbox control to it. I have this Textbox and Checkbox in my application: When Checkbox is ...
Vesa95's user avatar
  • 627
0 votes
0 answers
128 views

Bind WPF Expander.IsExpanded property to ListBox.ItemCount with IValueConverter

I have a ListBox that shows search results, grouped by their type, implemented like this: <ListBox.GroupStyle> <GroupStyle> <GroupStyle.ContainerStyle> <...
user2727133's user avatar
-3 votes
1 answer
739 views

WPF Binding SelectedItem to a property of another object

What I'd like to do is lookup a "Category" to bind the SelectedItem to based on CurrentItem.CategoryId where that would match with Category.Id. <ListBox ItemsSource="{Binding ...
rotormonkey's user avatar
0 votes
2 answers
185 views

c# wpf - When ValueConverter is used, MVVM doesn't update UI?

I'm just learning WPF, and ultimately what I'm trying to accomplish is a calculated column in a data grid where the number displayed there is the sum of a particular property in a collection. After a ...
rotormonkey's user avatar
0 votes
1 answer
274 views

How to pass a value to iValueConverter

I was trying to solve the following problem (and finally succeeded but probably not in the best way). This is how I tried first: I am showing a treeview with directories and a checkbox with this WPF ...
Dick's user avatar
  • 433
0 votes
2 answers
83 views

UWP GridViewItem Binding Thicknesss to ItemIndex

I have an AdaptiveGridView control with an ItemTemplate that consists of a Grid containing a StackPanel with an Icon and a TextBlock. I want to give each Grid of the GridViewItem's ItemTemplate a ...
Horacio Vásquez's user avatar
-1 votes
1 answer
137 views

Return DynamicResource in IValueConverter

I'm using my custom converter in my control's background. <Border Background="{Binding IsSelected, Converter={StaticResource SelectedToProfileBorderBackgroundConverter}}" CornerRadius=&...
Hhry's user avatar
  • 863
2 votes
1 answer
526 views

Xamarin Forms ConverterParameter XAML error Invalid Property Path Syntax

I have a text binding in my XAML as follows: Text="{Binding Converter={StaticResource ColumnToCaption}, ConverterParameter=-1}" It simply takes the column number and looks up what the ...
George M Ceaser Jr's user avatar
0 votes
1 answer
275 views

When language is set to French, decimal point separator ',' is ignored in binding to a double property

So I have an Entry bound to a double property with Keyboard="Numeric". NO StringFormat is used, and not modifying/forcing culture at app level. Confirmed that in French the decimal point ...
Cfun's user avatar
  • 8,630
0 votes
2 answers
1k views

WPF MarkupExtension to bind to a Dictionary

I have an application that uses a slightly modified ObservableConcurrentDictionary (exposed Count & added constructor for ConcurrentDictionary comparer) for data bound to custom FrameworkElements....
codebender's user avatar
-1 votes
2 answers
765 views

WPF Radiobutton Group - binding to a boolean

I have a radiobutton group which I binding to a boolean value but it isn't being picked up in the XAML - am sure it's something simple I am missing - any pointers appreciated. passed is set to false. ...
Ram's user avatar
  • 537
0 votes
1 answer
477 views

Xamarin Forms IValueConverter: Handle converting error

I have a IValueConverter which converts a byte[] to a string and vice versa. The converter is only able to convert it from an user given string to a byte when the string is correctly formated. Right ...
Max R.'s user avatar
  • 821
2 votes
0 answers
184 views

Bindable Property In IValueConverter Always Null

I have a converter that deals with Boolean values and uses them to pick either of two ImageSources. I defined the ImageSource as two parameters in the converter, later on I need to supply those ...
Scarnet's user avatar
  • 738
-1 votes
1 answer
144 views

How to translate Xamarin Xaml IValueConverter into C#?

Can you please help me translate this Xamarin xaml into c#? BackgroundColor="{Binding IconColor, Converter={StaticResource LocalHexColorFromStringConverter}}"/> Thanks!
ScumSprocket's user avatar
1 vote
1 answer
78 views

Random DependencyProperty.UnsetValue when multibinding

I got a weird problem. I got a collection of spaceObjects (planets) in an observablecollection. These objects move around the screen so their X and Y axis change all the time. This is the xaml code ...
InfoSpunge's user avatar
0 votes
1 answer
570 views

Xamarin.Forms not Calling the Converter

I want the Label element in Xamarin.Forms application to occupy 15% of the height. So, I was suggested that I use the Converter. Following is the code I used: My .xaml file <?xml version="1.0&...
kesarling He-Him's user avatar
0 votes
1 answer
185 views

IValueConverter uses the wrong culture with DateTime

Hi the below code is used to convert the DateTime format to current thread culture format public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo ...
user13892125's user avatar

1
2 3 4 5
14