|
I have to create a desktop client installation package with prerequisite as .NET framework. However in the prerequisite on publish tab is that .NET framework 4 is missing. How to include .net 4 as prerequisite in my package?
modified 24-Jan-18 5:53am.
|
|
|
|
|
I've got 4 RadioButtons:
<StackPanel Orientation="Vertical">
<pre>
<RadioButton Content="Labor/Equipment"
GroupName="builderTypeEntry"
IsChecked="{Binding BuilderType, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
<RadioButton Content="Labor/Equipment & Hardware"
GroupName="builderTypeEntry"
IsChecked="{Binding BuilderType, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
<RadioButton Content="Labor/Equipment, Hardware, & Trusses"
GroupName="builderTypeEntry"
IsChecked="{Binding BuilderType, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
<RadioButton Content="Labor/Equipment, Hardware, Trusses, & Lumber"
GroupName="builderTypeEntry"
IsChecked="{Binding BuilderType, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
They around bound to a property on the VM:
private int _BuilderType;
public int BuilderType
{
get { return _BuilderType; }
set
{
if (_BuilderType != value)
{
_BuilderType = value;
RaisePropertyChanged("BuilderType");
}
}
}
When I toggle thge buttons the property's Setter is being called twice - the first time sets it to 1 regardless of what button I click. The second time sets it back to 0.
On the first call the call stack only shows the call to the setter. The second call shows to RaisePropertyChanged, and then back to the setter again.
This is really bizarre. I can't figure this out. Anyone see what's wrong here??
If it's not broken, fix it until it is.
Everything makes sense in someone's mind.
Ya can't fix stupid.
|
|
|
|
|
Maybe because you're trying to bind all four radio buttons to the same property?
I'd expect to see either a converter on the IsChecked bindings to convert the int to a value, or four separate bool properties in the VM.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
We need to use WPF desktop application on Windows XP. I know Microsoft has stopped the support for XP.
Can you please let me know which .NET version i need to install?
Any idea what will be disadvantages?
|
|
|
|
|
You should use the latest version that is supported with XP which is 4.0. Note that it requires XP service pack 3.
The disadvantages are that you can't use features of newer .Net versions and that support for version 4.0 has ended January 2016.
|
|
|
|
|
I have a style that use in some combo boxes to display a separator:
<ComboBox ItemsSource="{Binding Items}"<br />
SelectedItem="{Binding SelectedItem}"
DisplayMemberPath="Caption"
SelectedValuePath="{Binding SelectedItemId, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}">
<pre>
<ComboBox.ItemContainerStyle>
<Style TargetType="{x:Type ComboBoxItem}"
BasedOn="{StaticResource {x:Type ComboBoxItem}}">
<Style.Triggers>
<DataTrigger Binding="{Binding Caption}" Value="">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ComboBoxItem}">
<Separator HorizontalAlignment="Stretch" IsEnabled="False"/>
</ControlTemplate>
</Setter.Value>
</Setter>
</DataTrigger>
</Style.Triggers>
</Style>
</ComboBox.ItemContainerStyle>
This works perfectly when I don't have a data template. In this next example I want a checked list so I have checkboxes as well as captions in a DataTemplate:
<ComboBox Grid.Row="0"
Grid.Column="3"
FontSize="14"
HorizontalAlignment="Left"
VerticalAlignment="Center"
MinWidth="250"
ItemsSource="{Binding Company.CompanyTypes}"
SelectedValuePath="{Binding SelectedCompanyTypeId, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
IsEnabled="{Binding AreFieldsEnabled}"
Margin="3">
<pre>
<ComboBox.ItemContainerStyle>
<Style TargetType="{x:Type ComboBoxItem}"
BasedOn="{StaticResource {x:Type ComboBoxItem}}">
<Style.Triggers>
<DataTrigger Binding="{Binding Caption}" Value="">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ComboBoxItem}">
<Separator HorizontalAlignment="Stretch"
IsEnabled="False"/>
</ControlTemplate>
</Setter.Value>
</Setter>
</DataTrigger>
</Style.Triggers>
</Style>
</ComboBox.ItemContainerStyle>
<ComboBox.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<CheckBox IsChecked="{Binding IsSelected}"
Margin="2"
HorizontalAlignment="Left"
VerticalAlignment="Center"/>
<TextBlock Text="{Binding Caption}"
Margin="2"
HorizontalAlignment="Left"
VerticalAlignment="Center"/>
</StackPanel>
</DataTemplate>
</ComboBox.ItemTemplate>
In this case the separator line doesn't appear, the bar itself is clickable, and the checkbox is showing.
How can I apply a stlye to solve these 3 problems?
Thanks
If it's not broken, fix it until it is.
Everything makes sense in someone's mind.
Ya can't fix stupid.
|
|
|
|
|
I am creating an application to learn WPF and MVVM pattern. I have a BindableCollection<string> in my ViewModel with anywhere from 1 to 5000 strings values.
I want to put a ListBox or other control in my View that is bound to this Collection. I want the TextBox to be divided into 3 columns and if the data goes further then the three columns can handle, scroll bars are created.
I have been searching for hours and can not find a method that is working. Can you anyone direct me in a direction to get this working?
|
|
|
|
|
Member 13610324 wrote: I have been searching for hours Probably because your requirements are a little weird, or at least the way you a looking at them.
For a start no user will want to look at 5000 items in a list - supply a filter before extracting the records from the database.
The textbox requirement is not valid, just bind your collection to the listbox, if your collection has more than the 3 columns then create specific columns in xaml (rather than auto generate). A data template will give you very fine control of the content.
If you set the column width to "Auto" it will resize to the content (I think). This may end up with a column wider than you view and a scroll bar on the listbox.
If you want to manage the width then use word wrap instead of scroll bars. This looks ugly but scroll bars are not available on each cell.
|
|
|
|
|
The 5k amount of data is not my request, it is that of my boss. Maybe if I explain the purpose of the application.
I work for a large truck dealership group. My boss wants a small desktop app that will read a .cvs file of repair order data -> have a box where he can enter the number of repair orders (up to 5k, idk why so much) -> press a button -> a list is populated with the RO number (String) of randomly selected ROs from the CVS file.
I am just trying to format some control to make three columns wide with vertical scroll bars if needed, each column will be a continuation of the last.
I laid here thinking last night, I could have the code in the viewmodel divide the primary collection into 3 new collections and have those collections bind to a datagrid or multiple column listbox.
|
|
|
|
|
Dwayne Barsotta wrote: divide the primary collection into 3 new collections No create the ONE new collection with 3 fields, bind that to the ListBox.
Dwayne Barsotta wrote: The 5k amount of data is not my request, it is that of my boss
As the developer you need to manage you bosses requirements, point out that loading 5k will be slow and he cannot possibly comprehend the detail of all those records. When he replies that he wants to look at some detail point out that he just defined a filter.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
I took your last comment to heart. After a discussion with him he finally understood, I informed him he needed to break his data down into more manageable chunks.
|
|
|
|
|
I read both your explanations, and still can't visualize your planned UI.
In any event, one might use a ScrollViewer to "wrap" the "target control" in order to provide it with scrollbars when it exceeds a certain dimension.
Note that the expected results depends on how the target control was constructed; i.e stack panels behave differenently than grids, when it comes to layout.
And sometimes, one has to disable one scrollbar, in order for the "other" (V or H) to work properly.
"(I) am amazed to see myself here rather than there ... now rather than then".
― Blaise Pascal
|
|
|
|
|
|
Seems I got downvoted for something here, not sure what. I completed the initial usable version of this application.
Per the comments, I received here I redesigned the GUI and operating concepts of the program. Keep in mind this was my first - fully installable C#-WPF-MVVM application ever (second C#).
When I got to a (mostly operational) point I had one small bug, I had our company programmer guy look at my program and direct me on my bug (i did have it right, just put the function call in the wrong place).
The main idea behind my program was to load a cvs file containing repair order numbers and warranty values, the user can select a min warranty value and the number of records wanted, click a button and the number of random records will be displayed. I was able to include several other (convienence) features as well.
I figured - since I got a lot of help here and I really like this site I would share the first version, I have made the GitHub repo public. Hopefully, it will help some others as well as offer me some constructive criticism.
BTW - I am being invited to help our code team at work on our in-house projects, this was brought on by him viewing the code for this project, ultimately from the help for y'all. I have always loved coding as a hobby and even took 2 years of online Computer Science, but at 41 years old I resigned myself to the idea I will not become a professional developer, well it looks like that is changing (at least ina small way).
This is my long-winded Thank You to all who help! The link to me GitHub Project is below!
[Link to my GitHub Project done with your help!]
|
|
|
|
|
If you believe the news, "programming", in terms of quality of life, has exceeded dental and other medical vocations as a preference.
Certainly if you can work remotely.
I have also found (almost) no "age" discrimination working remote versus "local".
(Only do "voice interviews" tho ... tell them "video chats" are for voyeurs).
"(I) am amazed to see myself here rather than there ... now rather than then".
― Blaise Pascal
|
|
|
|
|
As per title, I assume that is the problem.
My XAML is the following:
<Grid VerticalAlignment="Top" HorizontalAlignment="Left" Width="120" Height="30" Background="Black" x:Name="PopupParent">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="25"/>
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="0" x:Name="txt" Foreground="White"
VerticalAlignment="Center" Margin="10"
Text="Description" TextAlignment="Left">
<TextBlock.Style>
<Style TargetType="TextBlock">
<Setter Property="FontWeight" Value="Normal"/>
<Style.Triggers>
<DataTrigger Binding="{Binding Mode=OneWay,ElementName=PopupChild,Path=IsOpen}" Value="True">
<Setter Property="FontWeight" Value="Bold"/>
</DataTrigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
<Path Grid.Column="1" Width="10" Height="14" Stretch="Fill" Stroke="Black"
Fill="{Binding ElementName=txt,Path=Foreground}"
Data="F1 M 319.344,237.333L 287.328,218.849L 287.328,255.818L 319.344,237.333 Z "/>
<Popup
PlacementTarget="{Binding ElementName=PopupParent}"
x:Name="PopupChild"
Placement="Right"
AllowsTransparency="True"
PopupAnimation = "Slide">
<Popup.Resources>
<Storyboard x:Key="ImidiateClosePopupAnimation" TargetProperty="IsOpen" >
<BooleanAnimationUsingKeyFrames
Duration="0:0:0.0">
<DiscreteBooleanKeyFrame Value="False" KeyTime="100%"/>
</BooleanAnimationUsingKeyFrames>
</Storyboard>
<Storyboard x:Key="ClosePopupAnimation" TargetProperty="IsOpen">
<BooleanAnimationUsingKeyFrames
Duration="0:0:0.05">
<DiscreteBooleanKeyFrame Value="False" KeyTime="100%"/>
</BooleanAnimationUsingKeyFrames>
</Storyboard>
<Storyboard x:Key="OpenPopupAnimation" Name="OpenPopupAnimation2" TargetProperty="IsOpen">
<BooleanAnimationUsingKeyFrames Duration="0:0:0">
<DiscreteBooleanKeyFrame Value="True" KeyTime="100%"/>
</BooleanAnimationUsingKeyFrames>
</Storyboard>
</Popup.Resources>
<Popup.Style>
<Style TargetType="Popup">
<Style.Triggers>
<MultiDataTrigger>
<MultiDataTrigger.Conditions>
<Condition Binding="{Binding Mode=OneWay,ElementName=PopupParent,Path=IsMouseOver}" Value="False"/>
<Condition Binding="{Binding Mode=OneWay,ElementName=PopupChild,Path=IsMouseOver}" Value="False"/>
</MultiDataTrigger.Conditions>
<MultiDataTrigger.EnterActions>
<BeginStoryboard Storyboard="{StaticResource ClosePopupAnimation}"/>
</MultiDataTrigger.EnterActions>
<MultiDataTrigger.ExitActions>
<BeginStoryboard Name="OpenPopupAnimation2" Storyboard="{StaticResource OpenPopupAnimation}"/>
</MultiDataTrigger.ExitActions>
</MultiDataTrigger>
<DataTrigger Binding="{Binding Mode=OneWay,ElementName=PopupParent,Path=IsMouseOver}" Value="True">
<DataTrigger.EnterActions>
<PauseStoryboard BeginStoryboardName="closing"/>
<ResumeStoryboard BeginStoryboardName="OpenPopupAnimation2"/>
</DataTrigger.EnterActions>
</DataTrigger>
<EventTrigger RoutedEvent="MouseDown">
<EventTrigger.Actions>
<PauseStoryboard BeginStoryboardName="OpenPopupAnimation2"/>
<BeginStoryboard Name="closing" Storyboard="{StaticResource ImidiateClosePopupAnimation}"/>
</EventTrigger.Actions>
</EventTrigger>
</Style.Triggers>
</Style>
</Popup.Style>
<StackPanel Width = "200" Height = "100" Background = "Black" Margin = "5">
<TextBlock TextWrapping = "Wrap" Foreground = "White" Text = "Some information goes here"/>
<Button Content="I'm unstyled, Click me"/>
<Button Content="Or Click me"></Button>
</StackPanel>
</Popup>
</Grid>
What I'm trying to do is to have the popup appear when the mouse is over the Parent element and it will stay open as long as you are on the Parent element or its popup child. The popup closes when the mouse is no longer over any of these elements. The problem is that I want the popup to close when any of buttons on popup is pushed. As the code is now, the popup will close when the mouse is pressed on the popup, but not on the buttons. The problem is then that the animations refuse to restart and it won't show the popup when the mouse is over the parent item again. Any suggestions on what to do here?
|
|
|
|
|
Did you try setting popup's .IsOpen to false in the button handler?
One might assume popup is not "seeing" the button clicks due to the event routing in this case.
You could try adding a Button.Click handler on the popup if you can go with a common handler.
"(I) am amazed to see myself here rather than there ... now rather than then".
― Blaise Pascal
|
|
|
|
|
I did try out this:
<StackPanel Width = "200" Height = "100" Background = "Black" Margin = "5">
<StackPanel.Resources>
<Style TargetType="Button">
<Style.Triggers>
<EventTrigger RoutedEvent="Click">
<BeginStoryboard Name="closing" Storyboard="{StaticResource ImidiateClosePopupAnimation}"/>
</EventTrigger>
</Style.Triggers>
</Style>
</StackPanel.Resources>
<TextBlock TextWrapping = "Wrap" Foreground = "White" Text = "Some information goes here"/>
<Button Click="Button_Click" Content="I'm unstyled, Click me"/>
<Button Click="Button_Click" Content="Or Click me"></Button>
</StackPanel>
But that throws an error saying that:
Quote: Cannot resolve all property references in the property path 'IsOpen'. Verify that applicable objects support the properties.
I couldnt figure out what the problem was:
wpf - Cannot resolve all property references in the propertypath - Stack Overflow[^]
The button click does swallow the button pressed, and although I can use PreviewMouseDown, that will stop the click event. I could put all of this in a UserControl and hardcode everything, but this seemed very doable in XAML, or so I thought.
|
|
|
|
|
For me, if I can get there with less stress using some code-behind, I'll go with the code-behind.
I need to ship; sometimes daily.
"(I) am amazed to see myself here rather than there ... now rather than then".
― Blaise Pascal
|
|
|
|
|
Yeah, but this is really bugging me out. I did get it to work, sort of:
<Popup.Style>
<Style TargetType="Popup">
<Style.Triggers>
<MultiDataTrigger>
<MultiDataTrigger.Conditions>
<Condition Binding="{Binding Mode=OneWay,ElementName=PopupParent,Path=IsMouseOver}" Value="False"/>
<Condition Binding="{Binding Mode=OneWay,ElementName=PopupChild,Path=IsMouseOver}" Value="False"/>
</MultiDataTrigger.Conditions>
<MultiDataTrigger.EnterActions>
<BeginStoryboard Storyboard="{StaticResource ClosePopupAnimation}"/>
</MultiDataTrigger.EnterActions>
<MultiDataTrigger.ExitActions>
<BeginStoryboard Storyboard="{StaticResource OpenPopupAnimation}"/>
</MultiDataTrigger.ExitActions>
</MultiDataTrigger>
<EventTrigger RoutedEvent="Button.Click">
<BeginStoryboard Storyboard="{StaticResource ClosePopupAnimation}"/>
</EventTrigger>
</Style.Triggers>
</Style>
</Popup.Style>
But now the popup wont open again after I clicked the button.
|
|
|
|
|
I'm not sure that trying to manipulate the animation itself is better than working with .IsOpen.
All will affect the "state" of things in different ways.
"(I) am amazed to see myself here rather than there ... now rather than then".
― Blaise Pascal
|
|
|
|
|
I cheated and solved it:
<EventTrigger RoutedEvent="Button.Click">
<BeginStoryboard>
<Storyboard >
<DoubleAnimation Storyboard.TargetProperty="Width" To="0" Duration="0:0:0"/>
<DoubleAnimation BeginTime="0:0:01" Storyboard.TargetProperty="Width" To="210" Duration="0:0:0"/>
</Storyboard>
</BeginStoryboard>
</EventTrigger>
|
|
|
|
|
If there are no side-effects, works for me too.
"(I) am amazed to see myself here rather than there ... now rather than then".
― Blaise Pascal
|
|
|
|
|
Create a WPF custom control with Polygon. What can we do to Load 100000 of this custom control in a Canvas in under 2secs?
|
|
|
|
|
As you have written it I could say get better hardware.
In reality, it really would depend on what you want to do with the polygons? Hit testing etc? How are you drawing these, with DrawingVisuals? The best option would perhaps be to leverage DirectX directly?
|
|
|
|