Click here to Skip to main content
15,881,852 members
Home / Discussions / WPF
   

WPF

 
QuestionRequest Entity Too Large Pin
Mycroft Holmes25-May-16 21:57
professionalMycroft Holmes25-May-16 21:57 
AnswerRe: Request Entity Too Large Pin
Gerry Schmitz26-May-16 7:45
mveGerry Schmitz26-May-16 7:45 
GeneralRe: Request Entity Too Large Pin
Mycroft Holmes26-May-16 14:28
professionalMycroft Holmes26-May-16 14:28 
GeneralRe: Request Entity Too Large Pin
Mycroft Holmes26-May-16 17:58
professionalMycroft Holmes26-May-16 17:58 
QuestionHow to bind a nested Property of an attached Property Pin
Member 808505724-May-16 4:47
Member 808505724-May-16 4:47 
QuestionWPF Binding Question Pin
#realJSOP24-May-16 4:12
mve#realJSOP24-May-16 4:12 
AnswerRe: WPF Binding Question Pin
#realJSOP24-May-16 5:02
mve#realJSOP24-May-16 5:02 
QuestionBinding the x,y location on a Canvas with a ItemsControl Pin
Kenneth Haugland19-May-16 17:38
mvaKenneth Haugland19-May-16 17:38 
I have a simple UserControl that has one dependency property:
C#
public partial class MyUserControl : UserControl
{
    public MyUserControl()
    {
        InitializeComponent();
    }

    public double LocationX
    {
        get { return (double)GetValue(LocationXProperty); }
        set { SetValue(LocationXProperty, value); }
    }

    // Using a DependencyProperty as the backing store for LocationX.  This enables animation, styling, binding, etc...
    public static readonly DependencyProperty LocationXProperty =
        DependencyProperty.Register("LocationX", typeof(double), typeof(MyUserControl), new PropertyMetadata(0d));


}

The user control just has a single rectangle in it, and I want to bind it to the ItemsControl:
XML
<ItemsControl x:Name="myCanvas">
            <ItemsControl.ItemsPanel>
                <ItemsPanelTemplate>
                    <Canvas/>
                </ItemsPanelTemplate>
            </ItemsControl.ItemsPanel>
            <ItemsControl.ItemContainerStyle>
                <Style>
                    <Setter Property="Canvas.Left" Value="{Binding LocationX}"/>
                    <Setter Property="Canvas.Bottom" Value="0"/>
                </Style>
            </ItemsControl.ItemContainerStyle>
        </ItemsControl> 

Its binded to an ObservableCollection:
C#
public partial class MainWindow : Window
{
    ObservableCollection<MyUserControl> myData = new ObservableCollection<MyUserControl>();
    public MainWindow()
    {
        InitializeComponent();
        myData.Add(new MyUserControl() { LocationX = 50 });
        myData.Add(new MyUserControl() { LocationX = 350 });
        myCanvas.ItemsSource = myData;
    }
}

The Canvas.Bottom is set according to the value given, but the value I want to be binded won't work correctly. What Am I doing wrong here?
AnswerRe: Binding the x,y location on a Canvas with a ItemsControl Pin
Kenneth Haugland19-May-16 19:28
mvaKenneth Haugland19-May-16 19:28 
GeneralRe: Binding the x,y location on a Canvas with a ItemsControl Pin
Meshack Musundi23-May-16 2:54
professionalMeshack Musundi23-May-16 2:54 
GeneralRe: Binding the x,y location on a Canvas with a ItemsControl Pin
Kenneth Haugland23-May-16 11:26
mvaKenneth Haugland23-May-16 11:26 
GeneralRe: Binding the x,y location on a Canvas with a ItemsControl Pin
Pete O'Hanlon25-May-16 0:56
mvePete O'Hanlon25-May-16 0:56 
GeneralRe: Binding the x,y location on a Canvas with a ItemsControl Pin
Meshack Musundi25-May-16 1:27
professionalMeshack Musundi25-May-16 1:27 
QuestionRe: Binding the x,y location on a Canvas with a ItemsControl Pin
Kenneth Haugland7-Jun-16 20:22
mvaKenneth Haugland7-Jun-16 20:22 
GeneralRe: Binding the x,y location on a Canvas with a ItemsControl Pin
Meshack Musundi8-Jun-16 10:27
professionalMeshack Musundi8-Jun-16 10:27 
GeneralRe: Binding the x,y location on a Canvas with a ItemsControl Pin
Kenneth Haugland8-Jun-16 10:41
mvaKenneth Haugland8-Jun-16 10:41 
QuestionGet Datagrid Selected cell value in ViewModel Pin
indian14315-May-16 12:48
indian14315-May-16 12:48 
AnswerRe: Get Datagrid Selected cell value in ViewModel Pin
Pete O'Hanlon15-May-16 23:26
mvePete O'Hanlon15-May-16 23:26 
QuestionAdding Resources is giving errors not letting me add Resources Pin
indian14315-May-16 2:48
indian14315-May-16 2:48 
AnswerRe: Adding Resources is giving errors not letting me add Resources Pin
Richard Deeming16-May-16 1:21
mveRichard Deeming16-May-16 1:21 
GeneralRe: Adding Resources is giving errors not letting me add Resources Pin
indian14316-May-16 6:25
indian14316-May-16 6:25 
GeneralRe: Adding Resources is giving errors not letting me add Resources Pin
Richard Deeming16-May-16 6:28
mveRichard Deeming16-May-16 6:28 
GeneralRe: Adding Resources is giving errors not letting me add Resources Pin
indian14316-May-16 6:36
indian14316-May-16 6:36 
GeneralRe: Adding Resources is giving errors not letting me add Resources Pin
indian14316-May-16 14:03
indian14316-May-16 14:03 
GeneralRe: Adding Resources is giving errors not letting me add Resources Pin
Richard Deeming17-May-16 1:02
mveRichard Deeming17-May-16 1:02 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.