|
How I can understand how the principle of binding in WPF?
how I can connect things to do with the commands in MVVM pattern?
|
|
|
|
|
One of the easiest ways to get started in MVVM is with this[^] article. You can also get MVVM In The Box[^] training.
|
|
|
|
|
|
|
Hello,
I have a button which opens a popup.
I want the option - if user clicks in any place outside of this button or popup so it will be closed. otherwise it will be on screen.
How can i do it?
|
|
|
|
|
Try to grab focus and then when when the click event does not occur on the popup, close the popup.
To get the click event and check if the mouse pointer is not within the popup frame, use GetVisualDescendants .
|
|
|
|
|
how to use this GetVisualDescendants ?
|
|
|
|
|
|
|
Have a look here[^] for an example.
|
|
|
|
|
Hi,
Can anybody please tell me,
How I can move the expand collapse to the right hand side, instead of default left hand side ?? without changing the left side margin..
i mean tree view should be same as it is but the expand collapse only should move to right
|
|
|
|
|
Hi all,
I want to merge cells of a datagrid, using silverlight 4. How do I do?
Thank you very much for your attention.
|
|
|
|
|
|
Thank you very much. But I want to merge the cells which contains data, not the header. Can I do this with silverlight? Do you have any other suggestions?
|
|
|
|
|
Hello,
I have a popup which is opened on button click.
<Popup Name="MenuPopUp" IsOpen="False" PlacementTarget="{Binding ElementName=dropDownbtn}" Placement="Top" LostFocus="MenuPopUp_LostFocus" MouseLeftButtonDown="MenuPopUp_MouseLeftButtonDown">
<Grid>
<Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
</Grid.RowDefinitions>
<MenuItem Grid.Row="0" Name="ViewReportItem" Header="View Report" Command="{Binding ViewReportCommand}"/>
<MenuItem Grid.Row="1" Name="ExportReportItem" Header="Export Report" Command="{Binding ExportReportCommand}"/>
<MenuItem Grid.Row="2" Name="AbortReportItem" Header="Abort Report" Command="{Binding AbortReportCommand}"/>
</Grid>
</Popup>
I want the popup to stay on screen unless i click somewhere else in the UserControl.
This UserControl is small part of a big UserControl which is working using MVVM and PRISM
How can i do it?
|
|
|
|
|
Hello,
I have a button and a context menu on it.
I want to align the context menu to be opened on top of the button. I mean on the Upper Left corner of the button. How can i do it in XAML?
currently i use the code:
Button Grid.Column="1" BorderThickness="0" Name="dropDownbtn" Click="dropDownbtn_Click" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch">
<Image Source="/AQUA.ClientServices.Presentation;component/Images/dropDown.png" ClipToBounds="True" />
<Button.ContextMenu>
<ContextMenu BorderThickness="0" Name="LeftClickMenu" MouseLeave="LeftClickMenu_MouseLeave">
<MenuItem Name="ViewReportItem" Header="View Report" Command="{Binding ViewReportCommand}"/>
<MenuItem Name="ExportReportItem" Header="Export Report" Command="{Binding ExportReportCommand}"/>
<MenuItem Name="AbortReportItem" Header="Abort Report" Command="{Binding AbortReportCommand}"/>
</ContextMenu>
</Button.ContextMenu>
</Button>
|
|
|
|
|
The easiest way to do this is to use the ContextMenuService on the button itself. So, in your button definition, add ContextMenuService.Placement="Top"
|
|
|
|
|
OK.
Another issue is that this context menu opened on left mouse click on button.
But it never enters the can_execute .
But when i click Right Mouse Button it does enters can_execute.
How to solve it?
|
|
|
|
|
When I change an instance of an item in a collection, how do I refresh the View without reloading the entire collection?
Right now I'm doing something like:
var temp1 = Products;
Products = null;
Products = temp1;
Callinf RaisePropertyChanged doesn't do it.
Everything makes sense in someone's mind
|
|
|
|
|
I'm a bit confused by your question here. Are you just refreshing an individual property in a single item in the Products list? If so, just raise the PropertyChanged event on that property. Perhaps if you could describe the actual scenario you've got I might be able to offer some more advice.
|
|
|
|
|
Sorry, let me clarify...
I have a list of <productmodel>. If I change a single Product in the list, the item in my tree or list doesn't refresh. Calling RaisePropertyChanged("Products") will refresh the whole collection. To get that to work I have to reload the entore list.
So how do I update the UI so that only the changed item is refreshed?
Everything makes sense in someone's mind
|
|
|
|
|
FYI, you didn't properly encode <ProductModel>, so it doesn't show up (browser thinks it's an HTML tag). To others: he has a list of <ProductModel>.
|
|
|
|
|
Also, perhaps you could use an ObservableCollection? When an item changes, replace that item in the collection.
|
|
|
|
|
If a single item changes in your ProductItem object, simply call RaisePropertyChanged on that item. For instance:
public string ProductName
{
get { return productName; }
set
{
if (productName == value) return;
productName = value;
RaisePropertyChanged("ProductName");
}
} If you change the whole item, simply calling RaisePropertyChanged with an empty string will force every bound property in that item to be updated in the binding.
modified 21-Feb-12 15:38pm.
|
|
|
|
|
Looks like you've got a PRE penumbra.
|
|
|
|