Click here to Skip to main content
15,892,927 members
Home / Discussions / WPF
   

WPF

 
GeneralRe: Installation Requirements Pin
arkiboys14-Aug-11 5:36
arkiboys14-Aug-11 5:36 
GeneralRe: Installation Requirements Pin
Richard MacCutchan14-Aug-11 6:53
mveRichard MacCutchan14-Aug-11 6:53 
GeneralRe: Installation Requirements Pin
arkiboys14-Aug-11 7:16
arkiboys14-Aug-11 7:16 
GeneralRe: Installation Requirements Pin
Pete O'Hanlon14-Aug-11 8:03
mvePete O'Hanlon14-Aug-11 8:03 
GeneralRe: Installation Requirements Pin
arkiboys14-Aug-11 8:57
arkiboys14-Aug-11 8:57 
GeneralRe: Installation Requirements Pin
Richard MacCutchan14-Aug-11 8:04
mveRichard MacCutchan14-Aug-11 8:04 
GeneralRe: Installation Requirements Pin
arkiboys14-Aug-11 8:57
arkiboys14-Aug-11 8:57 
QuestionBinding in two way mode from a XML file to a combobox in usercontrol [modified] Pin
npuleio13-Aug-11 3:57
npuleio13-Aug-11 3:57 
Hello everyone,

I am making a sample application test with WPF creating some UserControls to increase maintainability.

In this way I created a toolbar usercontrol where I put a combobox and I created a dependency property, since it's the best tool for binding than datacontext when having more than one binding, and in main xaml I called a xmldataprovider loading a xml file to fill the combo box in the UserControl.

in the toolbar's usercontrol xaml file I put

<ComboBox ItemsSource="{Binding Path=epToolbarItemSource, RelativeSource={RelativeSource AncestorType={x:Type UserControl}}}" DisplayMemberPath="shortname" />


In the toolbar's usercontrol xaml.cs file I declared the dependency property as:

public static DependencyProperty ItemSourceToolbarProperty;

static epToolbar()
{
 epToolbar.ItemSourceToolbarProperty = DependencyProperty.Register("epToolbarItemSource", typeof(IEnumerable), 
         typeof(epToolbar));        
}

public IEnumerable ItemSourceToolbar
{
 get { return (IEnumerable)GetValue(epToolbar.ItemSourceToolbarProperty); }
 set { SetValue(epToolbar.ItemSourceToolbarProperty, value); }
}


In the Window.xaml file I declared the xmldataprovider as:

<XmlDataProvider x:Key="dpOperators" XPath="operators" Source="/Data/Operators.xml" IsInitialLoadEnabled="True" />


and I declared the usercontrol setting the dependency property I thought it was correctly declared, epToolbarItemSource:

<uc:epToolbar DockPanel.Dock="Top" epToolbarItemSource="{Binding Source=dpOperators, Mode=TwoWay}" />


In the examples found about Dependency Properties I always read the dependency property can be called as a property attribute when calling the usercontrol but in this case it says an error like: "The property 'epToolbarItemSource' was not found in type 'epToolbar'."

So I am asking here what's the right syntax to bind the content of xml file to the combo in the way I add new operators in the xmldataprovider so they would be inserted in xml file and refreshed the combo box?


Thanks in advance to all

Cheers, Luigi

modified on Sunday, August 14, 2011 12:48 PM

QuestionAccessing function on Usercontrol hosted from Window in MVVM and C# Pin
Alisaunder12-Aug-11 5:55
Alisaunder12-Aug-11 5:55 
AnswerRe: Accessing function on Usercontrol hosted from Window in MVVM and C# Pin
SledgeHammer0112-Aug-11 6:52
SledgeHammer0112-Aug-11 6:52 
GeneralRe: Accessing function on Usercontrol hosted from Window in MVVM and C# [modified] Pin
Alisaunder12-Aug-11 7:25
Alisaunder12-Aug-11 7:25 
GeneralRe: Accessing function on Usercontrol hosted from Window in MVVM and C# Pin
SledgeHammer0112-Aug-11 7:42
SledgeHammer0112-Aug-11 7:42 
GeneralRe: Accessing function on Usercontrol hosted from Window in MVVM and C# Pin
Alisaunder12-Aug-11 8:12
Alisaunder12-Aug-11 8:12 
GeneralRe: Accessing function on Usercontrol hosted from Window in MVVM and C# Pin
SledgeHammer0112-Aug-11 8:38
SledgeHammer0112-Aug-11 8:38 
GeneralRe: Accessing function on Usercontrol hosted from Window in MVVM and C# [modified] Pin
Alisaunder12-Aug-11 10:26
Alisaunder12-Aug-11 10:26 
GeneralRe: Accessing function on Usercontrol hosted from Window in MVVM and C# Pin
SledgeHammer0112-Aug-11 11:01
SledgeHammer0112-Aug-11 11:01 
GeneralRe: Accessing function on Usercontrol hosted from Window in MVVM and C# [modified] Pin
Alisaunder12-Aug-11 13:32
Alisaunder12-Aug-11 13:32 
GeneralRe: Accessing function on Usercontrol hosted from Window in MVVM and C# Pin
Alisaunder13-Aug-11 11:25
Alisaunder13-Aug-11 11:25 
GeneralRe: Accessing function on Usercontrol hosted from Window in MVVM and C# Pin
SledgeHammer0113-Aug-11 11:49
SledgeHammer0113-Aug-11 11:49 
GeneralRe: Accessing function on Usercontrol hosted from Window in MVVM and C# Pin
Alisaunder13-Aug-11 15:09
Alisaunder13-Aug-11 15:09 
GeneralRe: Accessing function on Usercontrol hosted from Window in MVVM and C# Pin
SledgeHammer0113-Aug-11 15:35
SledgeHammer0113-Aug-11 15:35 
GeneralRe: Accessing function on Usercontrol hosted from Window in MVVM and C# Pin
Alisaunder14-Aug-11 14:36
Alisaunder14-Aug-11 14:36 
GeneralRe: Accessing function on Usercontrol hosted from Window in MVVM and C# Pin
SledgeHammer0114-Aug-11 15:04
SledgeHammer0114-Aug-11 15:04 
GeneralRe: Accessing function on Usercontrol hosted from Window in MVVM and C# Pin
Alisaunder15-Aug-11 22:01
Alisaunder15-Aug-11 22:01 
Questionsiilverlight 4 - listbox to have Tag Pin
arkiboys12-Aug-11 4:32
arkiboys12-Aug-11 4:32 

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.