Could anyone explain the reasoning behind making say ItemsControl.DisplayMemberPath a dependency property and not just a regular CLR property?
Are there any real life scenarios when such properties are used in data binding scenarios, styles, or other dependency property related situations.
Thanks.
Update:
The reason for this question...
I have a ListBox and want the selection-mode to be extended. Also I want have to implement drag and drop functionality. The problem now is, that if the mouse is clicked on a selected item, it will be immediately be selected as single selection instead of waiting to the mouse-up-event for doing this.
Due to this behaviour, start dragging...
Hi!
I have a (main)window containing a Frame. A Page is loaded to that frame, with some viewmodel as its datacontext.
The View has some datagrids, where one is bound to the viewmodel and the other is bound to the selected.item (so that you get a master-details view..)
the problem occurs when I display a popup box, and set the mainwin...
Please anyone let me know how to set image in stack panel background in xaml ? I have already tried the following it throwing an error that Background does not have property Image
<Button.ToolTip>
<StackPanel Height="200" Width="200">
<StackPanel Height="30" Width="200" Orientation="Horizontal" HorizontalAlignmen...
While answering this question I noticed that I have never come across any property which is not a dependency property (WPF Controls, no 3rd party controls). Although, when I started with WPF I remember reading somewhere that "more then 90% of properties of WPF controls are dependency properties".
Can anyone give examples/links of CLR pr...
I have created a custom control in C# ( Overridden methods in Button control and added new events) . I need to use this control in my wpf application. In WinForms i can use this by ToolBox(right click) --> Choose Items -->Browse. where as in WPF i can not import the custom controls. Is there any way to do this
...
I've been needing to use a numeric up-down control for my WPF app. I read a similar question posted here and tried using the one available here > http://bot.codeplex.com/.
I added the references and referenced it in my XAML window
xmlns:lib="clr-namespace:PixelLab.Wpf;assembly=PixelLab.Wpf"
and did this.
<lib:NumericUpDown Name="yea...
Hi,
in my WPF UI, I use RoutedCommands that I refer to in my xaml via the following code:
Command="viewModel:MessageListViewModel.DeleteMessagesCommand"
I don't like this static link to my ViewModel class,I think this is not as nice as creating a custom ICommand implementation and use a syntax like the following
Command="{Binding De...
I want to set CanContentScroll to false of ScrollViewer that a Textbox have by default.
I tried by setting normal - ScrollViewer.CanContentScroll to false. Dint Work.
Override the default template of Textbox and set CanContentScroll of scrollviewer to false. Dint work.
...
Hi,
Anybody knows an open source product/framework, based in the MS stack, that allows modeling workflows (flowchart)?
It should allow:
- Drag and drop different node styles;
- Define properties for those nodes;
- Connect the nodes;
- Export to xml (non mandatory).
Any help is appreciated.
Regards
...
Situation is as follows:
A DataGrid has a RowDetailsTemplate, which contains another DataGrid (the subgrid). If you add a DataGridTemplateColumn which contains an EventHandler, a NullReferenceException is thrown by PresentationFramework.dll.
This issue is only present in .NET 4.0. If the project targets .NET 3.5 (and uses WPFToolkit f...
I have a DataTrigger setup like so:
<UserControl.Resources>
<Style x:Key="resultTypeStyle">
<Style.Triggers>
<DataTrigger Binding="{Binding Result, Path=Result.Type}" Value="Confirmation">
<Setter Property="Control.Visibility" Value="Collapsed" />
</DataTrigger>
</Style.Trigger...
I have a button on a view that is bound via a RoutedUICommand to a command defined in the ViewModel.
The XAML code excerpt from the view:
<Button Content="Login" Command="{Binding Login}" />
In the View's CodeBehind I add the command binding from the ViewModel to the view's binding collection:
this.CommandBindings.Add( viewModel.Lo...
When using Josh Smith's RelayCommand, most of the examples I've seen use lazy initialization such as:
public class ViewModel
{
private ICommand myCommand;
public ICommand MyCommand
{
get
{
if (myCommand == null)
{
myCommand = new RelayCommand(p => DoSomething() );
...
Hi,
I need to add several hyperlinks to the program's form dynamically at runtime (and handle user clicks on them).
How to do this?
I tried something like:
var hlink = new Hyperlink();
myStackPanel.Children.Add(hlink);
but hyperlink is not a UIElement...
Thanks!
...
I want to minimize my window , when I open other window/
This is a method in my user control which is in another user control, which is in another user control too.
WindowUploadFiles windowUploadFiles=new WindowUploadFiles();
//Minimize() - how to ?
windowUploadFiles.ShowDialog();
// Maximize() - how to ?
Has anybody expe...
class MyLine : Shape {
public static readonly DependencyProperty X11Property;
public static readonly DependencyProperty X22Property;
public static readonly DependencyProperty Y11Property;
public static readonly DependencyProperty Y22Property;
static MyLine() {
X11Property = DependencyProperty.Register("X11", ...
I've been using the following bit of code in a cookie cutter fashion, across dozens of classes
public event PropertyChangedEventHandler PropertyChanged;
protected void NotifyPropertyChanged(string propertyName)
{
if (PropertyChanged != null)
{
PropertyChanged(this, new PropertyChangedEventArgs(proper...
Hi, I try to change connection string, but it is only change in memory, but not in App.Config file, below is the code I am using
System.Configuration.Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
config.ConnectionStrings.ConnectionStrings[1].ConnectionString = "metadata=res://*/TCSModel.c...