|
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?
|
|
|
|
|
pix_programmer wrote: Is it scrollable
No. A viewbox can stretch to the size of the image.
You can define the width / height of the viewbox to allow a scroll.
<ScrollViewer VerticalScrollBarVisibility="Visible" HorizontalScrollBarVisibility="Visible" >
<Viewbox Stretch="UniformToFill" Width="100" Height="100">
<Image.../>
</Viewbox>
</ScrollViewer>
|
|
|
|
|
I want to implement a sort of tabbed navigation in WPF, that is, a TabControl with several TabItem s containing Frame s that host Page s.
Now the problem is that each Frame has its own navigation toolbar, while I want to have one single navbar placed entirely out of the TabControl . Also the navbar must be able to pilot the Frame that is in focus.
Any suggestion on how to do this? I googled a lot but could not find how. Thank you.
|
|
|
|
|
Im using styles for my WPF Windows. Is there an easy way that I can change values at runtime, so that all Elements which have this stlye will change there value?
Like in CSS ( Cascading Style Sheets )
At the moment I have to go to every Window and programm it like that:
in my XAML-Code I have buttons like this:
<Button Name"Button2" Style="{StaticResource myFunctionButtonStyle}" ...>
Allthough my button has a Style, I have to change the FontSize at runtime for evey Button in every Window like this:
private void SetFontSize(int i)
{
Button2.FontSize = i;
Button3.FontSize = i;
Button4.FontSize = i;
}
But this way is very redundant code. I have to this this for every Window and every Button!
But I cannot change the current style. I tryed something like this for my Window-Size:
((Style)Resources["MainWindow"]).Setters.Add(new Setter { Property = Window.WidthProperty, Value = (double)1024 });
But it doesn work because I cannot change the current style at runtime. It is just not allowed
|
|
|
|