How to Snoop proof your wpf application?

There actually is a way to detect whether your application is being “snooped” by the snoop program. The solution I will give is not a silver bullet, and if someone really wants to snoop your application, they’d have to modify the snoop source code (it’s an open source project). What snoop actually does is it … Read more

binding radiobuttons group to a property in WPF

Declare an enumeration similar to: enum RadioOptions {Option1, Option2} XAML: <RadioButton IsChecked=”{Binding SelectedOption, Converter={StaticResource EnumBooleanConverter}, ConverterParameter={x:Static local:RadioOptions.Option1}}”/> <RadioButton IsChecked=”{Binding SelectedOption, Converter={StaticResource EnumBooleanConverter}, ConverterParameter={x:Static local:RadioOptions.Option2}}”/> Converter class: public class EnumBooleanConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { return value.Equals(parameter); } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo … Read more

How I Can Refresh ListView in WPF

If you still need to refresh your ListView in any other case (lets assume that you need to update it ONE time after ALL the elements were added to the ItemsSource) so you should use this approach: ICollectionView view = CollectionViewSource.GetDefaultView(ItemsSource); view.Refresh();

How to use AlternationIndex in ItemsControls?

The ItemContainerStyle is applied to the elements generated by the ItemsControl: ContentPresenter. The ContentPresenter will in turn contain whatever you put in your ItemTemplate. In the case of a ListBox, the ItemContainerStyle is applied to the generated ListBoxItem. The AlternationCount is, based on what you posted, only available on these generated items. You cannot use … Read more

String format using MultiBinding?

you are trying to bind a string to an object. But StringFormat requires its target to be a string type. try putting a TextBlock in your label content and bind your data to it <StackPanel> <Slider x:Name=”sl1″ Minimum=”10″ Maximum=”100″/> <Slider x:Name=”sl2″ Minimum=”10″ Maximum=”100″/> <Label x:Name=”label13″ Background=”Yellow” Foreground=”Black”> <Label.Content> <TextBlock> <TextBlock.Text> <MultiBinding StringFormat=”{}{0} x {1} Test”> … Read more