|
Thank you Pete. And can you help in developing applications in WPF?
I've a small requirement.
I have one image that is in 2D. I want to shape it as 3D and then it should be rotated to all directions.. Can you help me in this scenario of how to develop this application?
|
|
|
|
|
|
Thank you Jani. And can you help in developing applications in WPF?
|
|
|
|
|
|
Hi all,
i fell a bit confuse about how save a FlowDocument to Xps.
I create FlowDocument "flowdocumentsample2.xaml" i set up it Build Action:Content ,Copy to Output Directory: Copy Always
FlowDocument doc = Application.LoadComponent(u) as FlowDocument;
FlowDocRdr.Document = doc;
Now i don't know the code how save the FLowDocument in the FlowDocumentReader to Xps .Im a new one in the WPF and my purpose of this feature is to create a report add new features to complete it but now i get stuck in this step .
DO you have any advice,suggestion to help me to understand better and work out my request.
Thanks so much .
Have a nice day.
BestRegards,
GooBye
|
|
|
|
|
We use a variation of this:
private void SaveToXps(string fileName, RichTextBox rtb)
{
if (string.IsNullOrEmpty(fileName))
{
throw new ArgumentNullException("fileName");
}
if (Path.GetExtension(fileName).ToLower() != ".xps")
{
fileName += ".xps";
}
using (FileStream stream = new FileStream(fileName, FileMode.OpenOrCreate, FileAccess.ReadWrite))
{
TextRange range = new TextRange(rtb.Document.ContentStart, rtb.Document.ContentEnd);
range.Save(fileName, DataFormats.XamlPackage);
}
}
|
|
|
|
|
HI Pete,
sorry for my later however i tried your advice
so i can save the document in .Xps but after i cannot read/open that file with the XPSViewer.exe...
XPSViewer got error:
I saw the file that i saved it is not empty but i don't why i cannot open it .
i used this code :"cannot open the document.The document may be not be a valid XPS document"
private void SaveToXps(string fileName)
{
if (string.IsNullOrEmpty(fileName))
{
throw new ArgumentNullException("fileName");
}
if (System.IO.Path.GetExtension(fileName).ToLower() != ".xps")
{
fileName += ".xps";
}
using (FileStream stream = new FileStream(fileName, FileMode.OpenOrCreate, FileAccess.ReadWrite))
{
TextRange range = new TextRange(FlowDocRdr.Document.ContentStart, FlowDocRdr.Document.ContentEnd);
range.Save(stream, DataFormats.XamlPackage);
}
}
and for the button this one:
private void SaveToXps_1(object sender, RoutedEventArgs e)
{
SaveToXps("C:\\test1.xaml");
}
Do you have any suggest for this error..
However thanks for your support.
Have a fun.
Bye
|
|
|
|
|
Hi
I have two diffrent Windows .. Window1.xaml and Window2.xaml .
Window2.xaml has a button and 3 text boxes.. and Window1.xaml has 3 textboxes aswell. I want to make it so that when i a user types is anything in Window2.xaml and then click the button it will copy the text and paste the text in Window1.xaml automatically ..
how can i achive this.. ?
Thanks in advance
|
|
|
|
|
What is a "form"? If this is WPF, can you post an example of the XAML?
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Sorry i did not mean form ..
I meant like Window1.xaml and Window2.xaml....
|
|
|
|
|
Basically, you have TextBox elements with their associated Text properties,
and you have a Button with a click event or an associated command.
When the button is clicked you can get the values of the Text property of the
TextBoxes and use them to set the Text properties of the TextBoxes in the
other window.
Which part of that are you having trouble with?
It's hard to give a specific solution without knowing the structure of
your code. There's so many different ways to achieve what you need.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Not to be of any bother ..
Can you give a example on how to achieve it.
Then i can expand from you example..
|
|
|
|
|
Here's an example of the two windows (XAML and code-behind), where the first window has the button.
<Window x:Class="WPFTester.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Window1" Height="150" Width="300" Background="SteelBlue" Loaded="Window_Loaded" >
<StackPanel>
<TextBox Name="TextBox1" Margin="8" />
<TextBox Name="TextBox2" Margin="8" />
<Button Content="Test" Width="80" Margin="8" Click="TestButton_Click" />
</StackPanel>
</Window>
namespace WPFTester
{
public partial class Window1 : Window
{
Window2 window2;
public Window1()
{
InitializeComponent();
}
private void Window_Loaded(object sender, RoutedEventArgs e)
{
window2 = new Window2();
window2.Show();
}
private void TestButton_Click(object sender, RoutedEventArgs e)
{
window2.TextBox1.Text = this.TextBox1.Text;
window2.TextBox2.Text = this.TextBox2.Text;
}
}
}
<Window x:Class="WPFTester.Window2"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Window2" Height="116" Width="300" Background="SteelBlue" >
<StackPanel>
<TextBox Name="TextBox1" Margin="8" />
<TextBox Name="TextBox2" Margin="8" />
</StackPanel>
</Window>
namespace WPFTester
{
public partial class Window2 : Window
{
public Window2()
{
InitializeComponent();
}
}
}
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
thank you
|
|
|
|
|
AFAIK we can access to each elemant of a Window1.xaml with the namespace & class name of it.
|
|
|
|
|
Hi all
Im trying to bind two comboboxes together. I have a table called country and a table called city in SQL database. When a user selects a country in the countrycombox i want it to filter the cities that are in that country and show them on the city Combobox.
Can some one help me please.
Thanks in advance
|
|
|
|
|
hello dear,
you can add one column in country table and one coulmn in city table the name of column may be "ExamineId" in both ethe tables then in country table put integer value(1,2,3,4,5.....) for every country in "ExamineId" column.and put the corresponding number for cities in city table.
like in country table
ExamineId country
1 country1
2 country2
in city table
ExamineId city country
1 abc country1
1 xyz country1
1 wpg country1
2 ghf country2
2 yhk country2
2 poi country2
select ExaminId from country table for selectes country and take it in one string type variable say "EId".
then make query for combobox2 as
select * from city where ExamineId = EId
and put all the data in combobox2.
hope it'll help u....
sandy
|
|
|
|
|
thank you
|
|
|
|
|
This seems a ridiculous idea to solve this kind of problem- "Changing backend to render UI" !! Crazy!!!
This should be very simple one...You better do a "Google" with the search keyword- "IsSynchronizeCurrentItem in WPF" rather changing the database schema.
sdixit110 wrote: you can add one column in country table and one coulmn in city table the name of column may be "ExamineId" in both
I am wondering how people find solutions like this...BAD SOLUTIONS!!!
Moim Hossain
R&D Project Manager
BlueCielo ECM Solutions BV
|
|
|
|
|
|
This is the general logic:
<StackPanel Orientation="Horizontal" DataContext="{Binding Source={StaticResource mySource}}">
<ComboBox ItemsSource="{Binding}" IsSynchronizedWithCurrentItem="True" />
<ComboBox ItemsSource="{Binding}" IsSynchronizedWithCurrentItem="True" />
</StackPanel> Obviously, you need to put your binding source into the context, and the paths you want to work with (plus any item templates you see fit), but this should get you started.
|
|
|
|
|
how can i resolve this problem in xaml file when ever i try to add
<grid> --- error (element expected...)
umerumerumer
|
|
|
|
|
Provide the expected element!
Seriously, a code sample would really help us help you.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Please post your XAML code.
|
|
|
|
|
Binding a property to a setting worked:
<Window x:Class="test"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:prop="clr-namespace:GTOWPF"
Height="{Binding Source={x:Static prop:Settings.Default}, Path=Win1H}"
Width="300">
Binding a property inside a datatemplate:
<Window x:Class="test"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:prop="clr-namespace:GTOWPF"
Height="100"
Width="300">
<Window.Resources>
<DataTemplate x:Key="Test">
<Grid Height="{Binding Source={x:Static prop:Settings.Default}, Path=Win1H}">
</Grid>
</DataTemplate>
</Window.Resources>
</Window>
Doesn't work,
Only public classes can be used in markup. 'Settings' type is not public.
Any sugestions?
modified on Wednesday, January 14, 2009 11:15 AM
|
|
|
|