|
|
I am new to silverlight MVVM technology. I am trying to creating an small app.
1.three textboxes which accept Ripee,Dollar,Pound.
2.When i entered any value to textbox, the other two textbox shold display corresponding currency .
|
|
|
|
|
You do this using data binding.
Bind properties to all three text boxes.
On the change of the first textbox, calculate currency and update properties attached to the other two textboxes.
|
|
|
|
|
can you please share some sample code.
|
|
|
|
|
|
|
thanks but still struggling for viewmodel
|
|
|
|
|
hi
i want using bordercolor animation
but i have many problem
To implement this, I spend a lot of time, but did not succeed.
when I put on the border, event does not occur , or
can not use the color property, or
changes in the text as far as border.
How one second over the border to change the color
of the animation could be used to
this is my failed my source
<Storyboard x:Key="MouseOver">
<ColorAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="border" Storyboard.TargetProperty="BorderBrush.Color" >
<LinearColorKeyFrame KeyTime="00:00:1" Value="#FF4387FF"/>
</ColorAnimationUsingKeyFrames>
</Storyboard>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Grid>
<Border x:Name="border />
<BeginStoryboard >
plz
help
me..
|
|
|
|
|
|
how to show data in combobox from database in silverlight
|
|
|
|
|
|
Fetch the data you need from the database via WCF and bind it to combo box.
|
|
|
|
|
|
I have a combobox column in a DataGrid.
I want the combo column's data source to be a list of LookupEntity called JobPhaseTypes on the VM:
public class LookupEntity
{
public int Id { get; set; }
public string Caption { get; set; }
}
The grid itself is bound to a list of JobPhase objects:
public class JobPhaseEntity : _BaseEntity
{
public int JobRevisionId { get; set; }
public string PhaseName { get; set; }
public LookupEntity JobPhaseType { get; set; }
public DateTime StartDateTime { get; set; }
public DateTime EndDateTime { get; set; }
}
}
So far I have this:
<DataGridComboBoxColumn Header="Phase Type"
SelectedItemBinding="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}, Path=DataContext.SelectedJobPhaseType}"
DisplayMemberPath="Caption"
Width="150">
<DataGridComboBoxColumn.EditingElementStyle>
<Style TargetType="{x:Type ComboBox}">
<Setter Property="ItemsSource" Value="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}, Path=DataContext.JobPhaseTypes}"/>
<Setter Property="IsReadOnly" Value="True"/>
<Setter Property="StaysOpenOnEdit" Value="True" />
</Style>
</DataGridComboBoxColumn.EditingElementStyle>
<DataGridComboBoxColumn.ElementStyle>
<Style TargetType="{x:Type ComboBox}">
<Setter Property="ItemsSource" Value="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}, Path=DataContext.JobPhaseTypes}"/>
</Style>
</DataGridComboBoxColumn.ElementStyle>
</DataGridComboBoxColumn>
When I change the combo's value on any row, it changes on all rows.
What am I doing wrong here?
Many thanks
If it's not broken, fix it until it is
|
|
|
|
|
I am working with a datagrid with a combobox, and it took me 3 hours to get it working, and that's only after I stumbled across an example.
So now I have this:
<DataGrid Grid.Row="1"
Grid.Column="0"
ItemsSource="{Binding JobPhases}"
SelectedItem="{Binding SelectedJobPhase}"
SelectionMode="Single"
SelectionUnit="Cell"
CanUserAddRows="False"
CanUserReorderColumns="False"
CanUserResizeColumns="True"
CanUserResizeRows="False"
CanUserSortColumns="True"
AutoGenerateColumns="False"
AlternatingRowBackground="Gainsboro"
IsSynchronizedWithCurrentItem="True"
AlternationCount="2"
FontSize="12"
IsReadOnly="False"
FontWeight="Normal"
FontStyle="Normal">
<DataGrid.Columns>
<DataGridComboBoxColumn Header="Phase Type"
SelectedItemBinding="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}, Path=DataContext.SelectedJobPhaseType}"
DisplayMemberPath="Caption"
Width="150">
<DataGridComboBoxColumn.EditingElementStyle>
<Style TargetType="{x:Type ComboBox}">
<Setter Property="ItemsSource" Value="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}, Path=DataContext.JobPhaseTypes}"/>
<Setter Property="IsReadOnly" Value="True"/>
<Setter Property="StaysOpenOnEdit" Value="True" />
</Style>
</DataGridComboBoxColumn.EditingElementStyle>
<DataGridComboBoxColumn.ElementStyle>
<Style TargetType="{x:Type ComboBox}">
<Setter Property="ItemsSource" Value="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}, Path=DataContext.JobPhaseTypes}"/>
</Style>
</DataGridComboBoxColumn.ElementStyle>
</DataGridComboBoxColumn>
</DataGrid.Columns>
</DataGrid>
The question I have is - can someone explain the syntax in the binding part?
What does 'RelativeSource' mean, and 'FindAncestor' and 'AncestorType'??
Many thanks!
If it's not broken, fix it until it is
|
|
|
|
|
I know this does not answer you question but it bears out our design decision to use dialogs. 3 hours faffing around trying to get a combo to work within a grid, 30 minutes to build a dialog, pop it and manage it. Hardest thing was finding a snippet to handle the double click on a grid which we did 3 years ago.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Actually, I agree with you. I normally use a dialog, but my client wants row editing.
If it's not broken, fix it until it is
|
|
|
|
|
Kevin Marois wrote: my client wants row editing
Bummer having to allow the client that level of say in the app design. Sorry I can't help.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
They pay the bills so they get what they want
If it's not broken, fix it until it is
|
|
|
|
|
|
Nice explanation. Thank you
If it's not broken, fix it until it is
|
|
|
|
|
I'm using MVVM...
I have been Googling this for a few hours, and I can't seem to find an example of how to set the focus to a cell and place it in edit mode.
When the user clicks the New button, I add a new object to the collection, and the row appears in the grid. However, I have to click twice in the first cell to enter edit mode.
Is there a way to do this from within the ViewModel? Or maybe a XAML based approach>
Thanks
If it's not broken, fix it until it is
|
|
|
|
|
Using a grid as a data entry tool bleh!
We use telerik and they have an edit on focus attribute, getting t it pragmatically probably involve walking the visual tree!
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Hi,
I have three image buttons close,minimize and maximize .The functionalities works fine as per the standard . Now my problem is when the current window is fully fixed to our screen window then the restore button image has to be visible not maximize button. In my screen in both the normal and fixed window only maximize button is highlighting , I want to restore image button when the window is fully fixed to screen.
|
|
|
|
|
You don't say if you are using MVVM or not so I can't be more specific. However, you want the content property of the maximize/restore button. Assigning that property to the two different images will change what is shown. It is a dependency property so you could bind it to a property on a viewmodel if you are using MVVM.
The window itself has a WindowsState property which indicates what the current window state is, minimized, normal, maximized. You can inspect that property to determine what state the window is in and set the button content appropriately. I think the window state property is a dependency property in WPF too so you should be able to bind it to a property on a ViewModel and set the button content within the property setter. If not, (and I could be wrong about it being a DP) you would hook the Resize event on the window and deal with it there.
HTH!
|
|
|
|