|
babongita wrote: but any item bound to an object (in this case a Combobox) that attribute is not populated
The above statement confuses me. It says any item bound to the object is not populated. You mean never or again just when you do something from code ?
|
|
|
|
|
OK, There is a listbox below, which is bound to Collection of Parameters(this is a class, not what you would typically think of when you think parameters), then there is a "view" above it which shows the "detail" (attributes) of the SelectedItem in the listbox. All of the TextBoxes or the CheckBoxes show the "detail" (attributes) correctly. But when the "detail" (attribute) is an item in a Combobox the item doesn't show in the Combobox even though it is bound to that "detail"(attribute). The combobox is populated with all of the possible selections, but the SelectedItem, isn't shown in that combobox.
|
|
|
|
|
I think that you are missing the ElementName in the ItemsSource Binding. In this case the ElementName is the x:Name of your window or UserControl.
<combobox x:name="cboParameterName" xmlns:x="#unknown">
IsSynchronizedWithCurrentItem="True"
TabIndex="10"
Grid.Column="1"
Grid.ColumnSpan="4"
ItemsSource="{Binding Path=ParameterNameCollection, ElementName=UserControl, Mode=Default}"
SelectedValue="{Binding SelectedParameter.Name}"
Style="{DynamicResource BaseComboBox}">
<combobox.itemtemplate>
<datatemplate>
<textblock text="{Binding ParameterDisplayName}">
|
|
|
|
|
No, he is using DataContext of the parent implicitly.
|
|
|
|
|
on a side note this happens with all of the comboboxes, but I have them all coded the same so I have the same issue.
|
|
|
|
|
|
When are you calling OnMouseUp ? Taking a guess, I think you do not need it. Looks like OnMouseDown and OnMouseMove are doing what you want ??
|
|
|
|
|
|
Prajeesh wrote: StartPoint = Args.GetPosition(PhotoBox);
In the MoveDown event, what is PhotoBox? shouldn't it be DrawingCanvas ?
I did the same thing you are doing, on the MouseMove and MouseLeftButtonDown event of the Canvas, and I never got any extra lines.
|
|
|
|
|
|
private void OnMouseMove(object Sender, MouseEventArgs Args)
{
if (Args.LeftButton == MouseButtonState.Pressed)
{
EndPoint = Args.GetPosition(DrawingCanvas);
DrawLine(StartPoint, EndPoint, DrawingCanvas);
//do not reset the startpoint
//StartPoint = EndPoint;
}
}
And in your DrawLine method, delete the old line before adding the new line.
|
|
|
|
|
|
Searching for the control and removing it from the Children collection.
Something like this,
Line previousLine = null;
foreach (UIElement child in TargetCanvas.Children )
{
if( child is Line)
{
previousLine = child as Line;
break;
}
}
if (null != previousLine)
{
TargetCanvas.Children.Remove(previousLine);
}
please update it to fit your needs.
|
|
|
|
|
|
Yes, I hope you can build ahead from the help you have been provided. What you could do is generate a new line name everytime you start drawing and use that line name in the MoveMouse for adding the new line and also for deleting the existing line.
|
|
|
|
|
I'd leave it if I were you. It looks like he wants you to give him the complete code.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys
|
|
|
|
|
I reminded him about the advise you had provided him few posts ago, but he doesn't seem to pay any heed to it.
|
|
|
|
|
I have a WPF application (client/server). i had created .exe file. when i install it on my client box it will install all the the dll's in the program files/manufactuere/ productname folder.It will install dll's of different languages also( spanish dll's in ES folder, portugese dll's in pt folder in program files/manufactuere/ productname)
What i need is when client is installing it i need to give him an option to select the language. based on the language it should install the concerning dll's in the client box.
Setup project is not giving any option to select language.
Please help thanks.
i used this article.
http://www.eggheadcafe.com/conversation.aspx?messageid=32327069&threadid=32327069
i did whole steps accordingly but when i try to install setupEn.msi its displaying in chinese.
i was wondering i am still not getting options for selecting the language.
|
|
|
|
|
Have you read the entire thread ? Because ahead in the thread the OP got the same issue and the person has provided a clarification for the same.
|
|
|
|
|
psdeepu wrote: Please help thanks
How many times are you planning on posting the same question?
Why is common sense not common?
Never argue with an idiot. They will drag you down to their level where they are an expert.
Sometimes it takes a lot of work to be lazy
Individuality is fine, as long as we do it together - F. Burns
Help humanity, join the CodeProject grid computing team here
|
|
|
|
|
Hi,
let's have a ListBox, bind to a observable Collection within a class instance in Xaml:
<ListBox ItemsSource="{Binding Path=MyInstance.MyCollection}"/>
Everything works as expected until the MyCollection-reference gets changed to another Instance of the Collection or even the Object-reference which contains the Collection gets changed to another Instance, like so:
Public WithEvents AnotherCollection As New ObservableCollection(Of Something)
MyInstance.MyCollection = AnotherCollection
or even
MyInstance = New MyClass
From this point on, the binding seems to be broken. Till now I worked around this by clearing the list and adding the items one by one.
Am I missing a better solution for this?
thank you,
dartrax
www.dartrax.de
|
|
|
|
|
Is your binding Two-way ? If not, try setting it Two-way and see if things work.
If not, try rebinding to the ItemsSource again or see if this[^] helps
|
|
|
|
|
Use the System.ComponentModel.INotifyPropertyChanged interface.
Let class A
class A : INotifyPropertyChanged
{
List<string> _list;
public List<string> List
{
get
{
return _list;
}
set
{
_list = value;
NotifyPropertyChanged("List");
}
}
private void NotifyPropertyChanged(string propertyName)
{
if (PropertyChanged != null)
PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
}
public event PropertyChangedEventHandler PropertyChanged;
}
a window
<Window x:Class="WpfApplication1.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Window1" Height="300" Width="300">
<StackPanel>
<ListBox ItemsSource="{Binding List}" />
<Button Click="Button_Click" Content="Change reference" />
</StackPanel>
</Window>
with a code behind containing
public partial class Window1 : Window
{
A _a;
public Window1()
{
InitializeComponent();
_a = new A();
_a.List = new List<string>
{
"a",
"b",
"c",
"d",
"e",
};
this.DataContext = _a;
}
private void Button_Click(object sender, RoutedEventArgs e)
{
_a.List = new List<string>()
{
"0",
"1",
"2",
"3",
"4",
"5",
"6",
"7",
"8",
"9",
};
}
}
Eslam Afifi
|
|
|
|
|
I got curious and tried your example, as it is. But it did not work for me I had to put this statement at the end of button click handler to make it work,
mylistbox.ItemsSource = _a.List;
I presume you have this working on your machine ?
|
|
|
|
|
It works without resetting the ItemsSource. I uploaded it here[^].
Eslam Afifi
|
|
|
|