|
Yes everything fired
but
PropertyChanged event in
private void NotifyPropertyChanged shows null.
Here is the code behind in Control2 to change button state in Control1
public void Somemethod()
{
Control1 ng = new Control1();
ng.EnabAdd =false;
}
and this is the property in codebehind in Control1
public bool EnabAdd
{
get { return _en; }
set
{
_en = value;
NotifyPropertyChanged("EnabAdd");
}
}
|
|
|
|
|
Sorry I do not think you have a good grasp of what it is that you are doing.
nitin_ion wrote: public void Somemethod()
{
Control1 ng = new Control1();
ng.EnabAdd =false;
}
This will do exactly nothing except create a new control1 and then disable it before going out of scope.
Your button is not being disabled because you have bound it to a property and not changing the property value. I suspect that your NotifyPropertyChanged is null because you have not set the DataContext. "Somemethod" is not a click event handler for a listbox.
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
Please stand in front of my pistol, smile and wait for the flash - JSOP 2012
|
|
|
|
|
Well yes i am new to Silverlight
SomeMethod is what i call on listviewitem click event.
I just want to changes the state of button when item is clicked. Is there any tutorial which can help me to do this?
|
|
|
|
|
finally got it like this
FrameworkElement fe = (FrameworkElement)this.Parent;
while (fe.GetType().Name != "parent")
fe = (FrameworkElement)fe.Parent;
var tyui=(Button)fe.FindName("controlintheparent");
|
|
|
|
|
Make you property as dependecny property as you code look ok may be binding is not workig as its not a depedency property.
|
|
|
|
|
Good day!
I have XamDataGrid control with option AutoGenerateFields set to False. When i switch this option to True i see all available colums.
I show my code:
<igDP:XamDataGrid
DataSource="{Binding AllProduction}"
Theme="Office2010Blue"
>
<igDP:XamDataGrid.FieldLayoutSettings>
<igDP:FieldLayoutSettings AutoGenerateFields="False"
HighlightAlternateRecords="True"
SelectionTypeCell="Single"
SelectionTypeField="Single"
SelectionTypeRecord="Single"/>
</igDP:XamDataGrid.FieldLayoutSettings>
<igDP:XamDataGrid.FieldSettings>
<igDP:FieldSettings x:Name="FieldSettings"
AllowCellVirtualization="True"
AllowEdit="True"
AllowGroupBy="True"
AllowLabelVirtualization="True"
AllowRecordFiltering="True"
AllowResize="True"
FilterClearButtonVisibility="Visible"
AllowFixing="Near"
AllowHiding="ViaFieldChooserOnly" />
</igDP:XamDataGrid.FieldSettings>
<igDP:XamDataGrid.FieldLayouts>
<igDP:FieldLayout >
<igDP:Field Name="Article" Label="Article" Width="45" IsScrollTipField="True"/>
<igDP:Field Name="Condition" Label="Condition" Width="50" />
<igDP:Field Name="Description" Label="Description" Width="50" />
<igDP:Field Name="Standartprice" Label="St. price" Width="50" IsScrollTipField="True"/>
<igDP:Field Name="Listprice" Label="List price" Width="50" >
</igDP:Field>
</igDP:FieldLayout>
</igDP:XamDataGrid.FieldLayouts>
<igDP:XamDataGrid.ViewSettings>
<igDP:GridViewSettings UseNestedPanels="True" />
</igDP:XamDataGrid.ViewSettings>
</igDP:XamDataGrid>
In FieldLayout section i defined some columns, but there are no columns when i run application.
Any suggestions ?
|
|
|
|
|
Make sure your datasource is populated.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Datasource is populated - 100%
|
|
|
|
|
hi
i want ask how i can connect my desktop with wp7 ?
wcf to control my pc via wp7 it possible in wcf?
|
|
|
|
|
You can connect WCF to WP7. Go through this[^] as an example.
However, I'm not sure I understand what you mean by connecting desktop to WP7.
|
|
|
|
|
i mean if i can use wcf to control my desktop( i mean control mouse and to read any files on my desktop via wp7 ) that i mean ?
|
|
|
|
|
hi there. Thats what I want. I want to build WPF UI to allow users to intuitively edit XMl.
My XML is as simple as this:
<publishers>
<publisher>
<name>Wiley</name>
<weblink>http://www.wiley.com</weblink>
<books>
<book>
<name>Project Management</name>
<price>10.00</price>
</book>
</books>
</publisher>
<publisher>
:
:
<books>
:
:
</books>
</publisher>
</publishers>
So how can I build one such UI. Please help. Thank you.
|
|
|
|
|
That's rather a broad question, to which there is not a simple answer. Assuming you have a basic knowledge of WPF applications you should take a look at some of the articles[^] here on CodeProject for sample code that may help you.
Binding 100,000 items to a list box can be just silly regardless of what pattern you are following. Jeremy Likness
|
|
|
|
|
Don't think in terms of XML; think classes and objects.
Create a WPF app that manages instances of publishers and books:
List<Publisher> Publishers;
Class Publisher {
...
List<Book> Books;
...
}
Class Book {
...
}
Use the .Net XmlSerializer class to write and read the object graph to and from XML.
|
|
|
|
|
i am trying to develop a WPF application, i have a mainwindow composed with 3 tabitems, i want to show Wpfpage when i click on bouton in tabitem3, how can i use "mdi container" in WPF application to show WPFpage
|
|
|
|
|
Hi!
I've added a Scrollviewer to my Screen. Inside the scrollviewer, I've added a scrollpanel and inside which a set of images. I've added the functionality for the tap event of the scrollpanel. I've to add two more sets of scrollviewer, scrollpanel and images(different ones from the first set of images) to the same screen. The functionality for the second and third set of scrollviewer is same with the first one. How to add these two more new scrollviewers? I can't use the same name for these three scrollpanels. How to design so that the existing code can be used for the new scrollviewer and scrollpanel sets also?
|
|
|
|
|
Create a UserControl that contains a ScrollViewer, etc. and the event handling code.
Then add as many of these UserControls to your "screen" as you need. Customize each UserControl by setting the appropriate properties (eg. image paths).
|
|
|
|
|
I am developing a silverlight application using MVVM pattern. I have a service which returns a string. I need to write that string in a text file. I call the save file dialog method in the service callback only when the returned string value is not null or empty. Here the problem is getting an exception in the savefiledialog statement "Quote: Dialog must be user initiated "
Quote: private void Service_Completed(ServiceCompletedEventArgs e)
{
if (e.Result != null)
{
if (string.IsNullOrEmpty(e.Result.Item))
{
MessageBox.Show("Empty Result"));
return;
}
bool? dialogResult = this.dialog.ShowDialog();
if (dialogResult == true)
{
byte[] fileBytes = UTF8Encoding.UTF8.GetBytes(e.Result.Item);
using (Stream stream = (Stream)this.dialog.OpenFile())
{
stream.Write(fileBytes, 0, fileBytes.Length);
stream.Close();
}
}
}
}
Please help me how to troubleshoot this exception in the event handler callback
G Nathan
|
|
|
|
|
|
Hi,
In my View
I have a datagrid and a 'Undo' button. On 'Undo' I am showing a BusyIndicator.
Suppose,
1) I try to add a new row in the datagrid
2) Datagrid row goes into the error state because of some validation failure
3) While datagrid is in edit mode, without loosing focus on the datagrid, I presses a shortcut 'Ctrl+Z' to Undo changes
Following exception occurs:-
System.Windows.Media.Animation.AnimationException: Cannot animate the 'IsEnabled' property on a 'System.Windows.Controls.ContentControl' using a 'System.Windows.Media.Animation.ObjectAnimationUsingKeyFrames'. For details see the inner exception. ---> System.InvalidOperationException: 'NewItemPlaceholderPosition' is not allowed during a transaction begun by 'AddNew'.
Actually on DataGrid LostkeyboardFocus i explicitly CommitEdit and CommitNew for the datagrid. So, if I press the 'Undo' button with mouse everything works fine.
But if I presses a shortcut while datagrid is in edit mode and focus is still in the datagrid, then the BusyIndicator, while setting status to BUSY, tries to change IsEnabled of the datagrid and the exception occurs.
Please help me if anyone has a solution
|
|
|
|
|
Sorry that I'm not going to be able to help, I have a basic design principle that will not allow the user to add rows to a grid, I insist that a dialog or detail panel is used for all but the most trivial editing process. It eliminates all sorts of issues I see posted here!
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
My aim is to change some values in my style at runtime. So what Im gonna do is, I clone the current style and change the values I want to change. But then I have a problem to add the style to the Resources. Is there away?
At the moment I just can load a whole xaml-file.
In the code is at the and the point where I have problems:
I have a
tyleClone ( clone of the current style) which I want to add to
this.Resources
public MainWindow()
{
InitializeComponent();
using (FileStream fs = new FileStream(@"C:\projekte\MyButtonStyle.xaml", FileMode.Open))
{
ResourceDictionary rd = (ResourceDictionary)XamlReader.Load(fs);
this.Resources = rd;
}
var style = new Style();
style = ((Style)Resources["myFunctionButtonStyle"]);
var styleClone = new Style();
foreach (var setter in style.Setters)
{
var typedSetter = setter as Setter;
if (typedSetter != null)
{
var newSetter = new Setter(typedSetter.Property, typedSetter.Value);
styleClone.Setters.Add(newSetter);
}
}
styleClone.Setters.Add(new Setter { Property = Button.FontSizeProperty, Value = (double)111 });
this.Resources.Add( )
}
|
|
|
|
|
Hi!
I've added a Scrollviewer(Horizontal) to my screen. Inside this scrollviewer I've added a stackpanel. I want to add images one after other into this stackpanel. How to add images to the stackpanel?
|
|
|
|
|
Try
<StackPanel Height="140" Orientation="Horizontal">
<Image Source="..."/>
</StackPanel>
Here[^] is an example on how to use the Image control.
You can also consider other controls like a ViewBox [^] instead of a StackPanel . A ViewBox provides inbuilt transform capabilities.
|
|
|
|
|
Abhinav S wrote:
You can also consider other controls like a ViewBox[^] instead of a StackPanel
Is it scrollable. I want horizontally scrollable pictures. For that I've added a Scrollviewer inside which I've added a StackPanel. Inside this StackPanel I've to add pictures and implement Horizontal Scrolling. Is this possible with ViewBox?
|
|
|
|