|
|
Hi,
I am planning to move my VBA/Excel application to WPF or WinForm C#, and adding some cool features. Basically I would like to load a map from google/Bing or manually, draw lines (pipe network) and after make some calculation on these lines. Until now I use several programs to do that Autocad for drawing, Excell for calculation etc.
There are already a lot of apps doing some part of what I want to achieve. Google Map for drawing lines on map, EPANET free framework for pipe networks - but no examples how to integrate its features into C#. Also, commercials editions WaterCAD of Bentley and ArcGIS.
So my question is … will WPF relief my pain or should I stick with WinForm to achieve the above?
|
|
|
|
|
I have a ListBox with a custom item template, as follows:
<ListBox x:Name="AheadListBox"
FontSize="20"
BorderBrush="Transparent" BorderThickness="0,0,0,0"
Background="Transparent"
ScrollViewer.VerticalScrollBarVisibility="Auto"
ScrollViewer.HorizontalScrollBarVisibility="Hidden">
<ListBox.ItemTemplate>
<DataTemplate>
<Grid >
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Ellipse Grid.Column="0" Width="20" Height="20"
VerticalAlignment="Top"
HorizontalAlignment="Left"
Margin="5,0,0,0">
<Ellipse.Fill>
<RadialGradientBrush GradientOrigin=".5,.3">
<GradientStop Color="LightSteelBlue" Offset="0.05"/>
<GradientStop Color="DarkBlue" Offset="0.9"/>
<GradientStop Color="DarkBlue" Offset="1"/>
</RadialGradientBrush>
</Ellipse.Fill>
</Ellipse>
<TextBlock Grid.Column="1"
Text="Some really long text string to test the veracity of my XAML Layout. Of course, nothing works the first time where Silverlight is concerned"
Margin="10,0,10,0"
TextWrapping="Wrap" />
</Grid>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
I want the TextBlock to automatically grow vertically to accomodate all of the text it contains. Things I've tried:
0) At first, I had a StackPanel for a container, but I changed to a Grid to see if that would fix it (no fix was forthcoming).
1) I tried using a Label control instead of a TextBlock .
2) If I manually insert a "\r\n" somewhere in the string, it will grow as expected, but that's not the way the text will be fed to the control.
3) Setting Height="Auto" doesn't appear to have any effect.
4) I also tried calling ListBox.InvalidateMeasure() and ListBox.InvalidateArrange() after the listbox was populated.
5) If I set a hard-coded width for the TextBlock in the XAML, the TextBlock grows vertically as expected.
One other aspect of control (just in case you missed it) - the ListBox is set to expand/contract with its parent container, so the amount of space available to the listbox item will change accordingly.
It's starting to look like I have to do this manually. So much for separating the layout from the business logic...
SOLUTION ===============================
I had to set the horizontal scrollbar to disabled. Once I did that, it bahaved the way I thought it was supposed to.
.45 ACP - because shooting twice is just silly----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997----- "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001
modified on Thursday, May 13, 2010 1:17 PM
|
|
|
|
|
Hi,
I am using LINQ to SQL and MVVM pattern in my application where i am retrieving
my data by the following query:
internal ObservableCollection<INVCategory> GetCategoryList()
{
DataLoadOptions dataLoadOptions = new DataLoadOptions();
dataLoadOptions.LoadWith<INVCategory>(t => t.INVSubCategories);
this.Context.LoadOptions = dataLoadOptions;
var categories = from category in this.Context.INVCategories
orderby category.CatgeoryId descending
select category;
return new ObservableCollection<INVCategory>(categories.ToList());
}
And my XAML code for parent(Category) combo is:
<ComboBox Grid.Column="1" Grid.Row="0" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Margin="0,2,10,2" TabIndex="0" x:Name="categoryComboBox"
ItemsSource="{Binding CategoryList}" IsEditable="True" DisplayMemberPath="CategoryName" SelectedValuePath="CatgeoryId" SelectedItem="{Binding CategoryList, Mode=TwoWay}" SelectedValue="{Binding Path=CurrentEntity.CategoryId, Mode=TwoWay}" >
</ComboBox>
for child(Subcategory) combo i am using:
<ComboBox Grid.Column="1" Grid.Row="1" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Margin="0,2,10,2" TabIndex="1"
ItemsSource="{Binding SelectedItem, ElementName=categoryComboBox, Mode=OneWay}"
DisplayMemberPath="SubCategoryName" SelectedValuePath="SubCategoryId"
SelectedItem="{Binding INVSubCategories, Mode=TwoWay}">
</ComboBox>
But my child combo items is not populated during form loading as well as parent combo's
selection changed though my parent combo items are populated.
i can't figure out why my child combo is not functioning based on parent combo's
selected item ,please help me.
|
|
|
|
|
Check whether you implemented INotifyPropertyChanged interface for Category class object.
|
|
|
|
|
Thanks Castle Rider for your reply.
I have made a Generic "BasePresenter" class where i have implemented INotifyPropertyChanged interface in the following way:
public event PropertyChangedEventHandler PropertyChanged;
protected void OnPropertyChanged(string propertyName)
{
PropertyChangedEventHandler handler = this.PropertyChanged;
if (handler != null)
{
handler(this, new PropertyChangedEventArgs(propertyName));
}
}
And in my Presenter class I have used:
public ObservableCollection<INVCategory> CategoryList
{
get
{
return this.categoryList;
}
set
{
this.categoryList = value;
OnPropertyChanged("CategoryList");
}
}
|
|
|
|
|
Try adding UpdateSourceTrigger=PropertyChanged along with the ItemsSource Binding xaml.
|
|
|
|
|
I am not clear. Would you please send me a sample code.
|
|
|
|
|
Try this binding in categoryCombo
SelectedValue="{Binding Path=CurrentEntity.CategoryId, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
|
|
|
|
|
Hello,
My machine has xp pro 64bit.
I currently have VS2008.
Can you see why I can not install VS2010 express please?
The error is:
DownloadManager Information: 0 : Loading product xml from 'https://go.microsoft.com/fwlink/?LinkId=158722'
DownloadManager Information: 0 : Product manager downloading: https://go.microsoft.com/fwlink/?LinkId=158722
DownloadManager Information: 0 : Remote file has not changed, using local cached file:C:\Documents and Settings\Administrator\Local Settings\Application Data\Microsoft\Web Platform Installer\-2016837979.xml.temp
DownloadManager Information: 0 : Loading product xml from 'https://www.microsoft.com/web/webpi/2.0/WebApplicationList.xml'
DownloadManager Information: 0 : Product manager downloading: https://www.microsoft.com/web/webpi/2.0/WebApplicationList.xml
DownloadManager Information: 0 : Remote file has not changed, using local cached file:C:\Documents and Settings\Administrator\Local Settings\Application Data\Microsoft\Web Platform Installer\-1244381891.xml.temp
DownloadManager Information: 0 : Filtering by majorOS: 5, minorOS: 2, majorSP: 2, minorSP: 0, productType: 1, architecture: x64
DownloadManager Information: 0 : Filtering by majorOS: 5, minorOS: 2, majorSP: 2, minorSP: 0, productType: 1, architecture: x64
DownloadManager Information: 0 : Contextual entry products: VWD2010
DownloadManager Information: 0 : Adding product Visual Web Developer 2010 Express (VWD2010) to cart
DownloadManager Information: 0 : Contextual navigation to product 'VWD2010'
DownloadManager Information: 0 : Product 'VWD2010' was already in cart.
DownloadManager Information: 0 : No SQL to configure
DownloadManager Information: 0 : No MySQL to configure
DownloadManager Information: 0 : Setting current install to 1
DownloadManager Information: 0 : Starting install sequence
DownloadManager Information: 0 : Using cached file at C:\Documents and Settings\Administrator\Local Settings\Application Data\Microsoft\Web Platform Installer\installers\VWD2010\dd6b1454fe3f90ea126cf550ae344f8e5b831786\vwd_web.exe instead of downloading from http://download.microsoft.com/download/0/D/6/0D600544-AD1A-45FB-8D40-838EBF3C03EC/vwd_web.exe
DownloadManager Information: 0 : Starting EXE install for product 'Visual Web Developer 2010 Express'. Commandline is: 'C:\Documents and Settings\Administrator\Local Settings\Application Data\Microsoft\Web Platform Installer\installers\VWD2010\dd6b1454fe3f90ea126cf550ae344f8e5b831786\vwd_web.exe /x:C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\vwd\ /q'
DownloadManager Information: 0 : Waiting for process: 2876 - C:\Documents and Settings\Administrator\Local Settings\Application Data\Microsoft\Web Platform Installer\installers\VWD2010\dd6b1454fe3f90ea126cf550ae344f8e5b831786\vwd_web.exe
DownloadManager Information: 0 : Install exit code for product 'Visual Web Developer 2010 Express' is 0
DownloadManager Information: 0 : Starting EXE install for product 'Visual Web Developer 2010 Express'. Commandline is: 'C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\vwd\setup.exe /q /norestart /web'
DownloadManager Information: 0 : Waiting for process: 5104 - C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\vwd\setup.exe
DownloadManager Information: 0 : Install exit code for product 'Visual Web Developer 2010 Express' is 5100
DownloadManager Error: 0 : Install return code for product 'Visual Web Developer 2010 Express' is Failure
DownloadManager Information: 0 : Product Visual Web Developer 2010 Express done install completed
DownloadManager Information: 0 : Increasing current install to 2
|
|
|
|
|
|
Hi Michel,
I do not follow what you mean. Please explain. thanks
|
|
|
|
|
You have an error 5100 during setup (generic setup block). The causes for error 5100 are explained in the link
|
|
|
|
|
What SP should I have on my xp pro 64bit pls?
|
|
|
|
|
Well, normally SP3 is the latest and greatest, but I don't think it exists for XP-64. SP2 is the last there. The problem might be that setup checks for SP3, and buggers off. In that case, you have a definite problem.
If you think this is your problem, you'd better post a new question (preferably in the .Net forum), asking something like 'has anyone installed VS 2010 on XP professional 64 bit edition, and what are the problems/requirements'. Have a google also, someone may have had the same problem.
|
|
|
|
|
Is it ok to have VS 2005 and 2008 installed already and then install VS 2010 express?
Before installing vs 2010 express, should I uninstall 2005 and 2008 versions?
Thanks
|
|
|
|
|
NORMALLY, they should be able to run side by side. But I've heard so many problems, (especially if BETA versions were involved), that grown men were driven to tears, and had to re-install their whole system after taking 3 aspirins, invoking their personal totem in the Valhalla, and decorating their body with old MSDN Cd's.
Your mileage may vary
|
|
|
|
|
Those CDs can irritate the skin, too. Microsoft obviously didn't test them with a very wide range of adhesives.
.45 ACP - because shooting twice is just silly ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001
|
|
|
|
|
I can't seem to figure out how to apply Commanding to a TreeView node change. Google is sparse on the subject.
Anyone have an example of this?
Everything makes sense in someone's mind
|
|
|
|
|
You don't apply commands to a node change. What you capture is the fact that the SelectedItem has changed and use that instead.
"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 | Onyx
|
|
|
|
|
hello
Where do I look up color code ... ? The following from my WPF app xaml:
<Window.Resources>
<Style TargetType="{x:Type ListBoxItem}">
<Style.Triggers>
<Trigger Property="ItemsControl.AlternationIndex" Value="0">
<Setter Property="Background" Value="#19f39611"></Setter>
</Trigger>
<Trigger Property="ItemsControl.AlternationIndex" Value="1">
<Setter Property="Background" Value="#19000000"></Setter>
</Trigger>
</Style.Triggers>
</Style>
Thanks
dev
|
|
|
|
|
#aarrggbb
An eight-digit hexadecimal number. The first two digits specify the color's A value, the next two specify its R value, the next two specify its G value, and the final two specify its B value. For example, FF0000FF.
Frome here: MSDN[^]
I don't speak Idiot - please talk slowly and clearly
'This space for rent'
Driven to the arms of Heineken by the wife
|
|
|
|
|
By default properties for user-control appear under Miscellaneous/Misc Tab in Expression Blend/ Visual Studio. Can we force it to appear under a particular tab? Better, can we define our own tab based on property type?
|
|
|
|
|
hello , I am looking for WPF partner to join me to build very Cool Desktop App , I have some idea and i think this app should be very Successful ,
I have 4 software Contain all the WPF Controls We need ,
Telerik
Xceed
Infragistics
ComponentArt
all this software Full and with source ,
if you want join me please Contact me so that we can talk about my ideas and what kind of app i am talking about
avisynth1402@gmail.com
|
|
|
|
|
In switching to Silverlight 4 for my solution, I also upgraded to the April,2010 release of the toolkit and replaced the System.Windows.Controls.Toolkit.dll in my Debug folder. But I'm still getting two errors when I try to build the solution:
C:\My Source 2010\PHDWebsite\PHDWebsite\obj\Debug\MainPage.g.i.cs(62,42): error CS0234: The type or namespace name 'DockPanel' does not exist in the namespace 'System.Windows.Controls' (are you missing an assembly reference?)
I have this declaration in MainPage.xaml:
xmlns:controlsToolkit="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Toolkit"
The second is just a warning and is related:
C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1360,9): warning MSB3245: Could not resolve this reference. Could not locate the assembly "System.Windows.Controls.Toolkit, Version=2.0.5.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors.
I've checked the System.Windows.Controls.Toolkit.dll and it does contain DockPanel and so does the April toolkit documentation.
What do I have to do to resolve this issue that currently has me dead in the water?
|
|
|
|
|