Use Ribbon Control in WPF Toolkit in XAML [closed] - wpf

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 7 years ago.
Improve this question
How to use the Ribbon control in WPf toolkit in my XAML?
How to include the namespaces for ribbon in XAML?

Good link Trainee4Life, just like this one.

As per the walkthrough:
<r:RibbonTab Label="Banking">
<r:RibbonGroup>
<r:RibbonButton Command="me:AppCommands.Cut"/>
<r:RibbonButton Command="me:AppCommands.Copy"/>
<r:RibbonButton Command="me:AppCommands.Paste"/>
</r:RibbonGroup>
<r:RibbonGroup>
<r:RibbonButton Command="me:AppCommands.AddNew"/>
<r:RibbonButton Command="me:AppCommands.Clear" />
<r:RibbonButton Command="me:AppCommands.Delete"/>
</r:RibbonGroup>
<r:RibbonGroup>
<r:RibbonButton Command="me:AppCommands.DownloadStatements"/>
<r:RibbonButton Command="me:AppCommands.DownloadCreditCards"/>
<r:RibbonButton Command="me:AppCommands.Transfer"/>
</r:RibbonGroup>
</r:RibbonTab>

I did work with Ribbon for a considerable amount of time. Nothing beats these tutorials.
http://www.uxpassion.com/2009/08/wpf-ribbon-control-roadmap-and-look-into-the-future/
And for the namespace problem, include a reference to RibbonControlsLibrary.dll in your project, and use the following line to point to the namespace.
xmlns:r="clr-namespace:Microsoft.Windows.Controls.Ribbon;assembly=RibbonControlsLibrary"

Related

Call RelayCommand in WPF-Control from WPF-Windows (XAML) [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 2 years ago.
Improve this question
I have a WPF UserControl with a ViewModel as DataContext. This ViewModel also contains RelayCommands. From the control I can call these commands (e.g. with a button) <Button Command="{Binding SaveCommand}">Save</Button>. Now I want to place the control in a window and call the commands from there <Button Command="{Binding SaveCommand}" CommandTarget="{Binding ElementName=myControl}">Save</Button>. But this does not work. How can I call a command in a child control in XAML?
Thanks a lot
Markus
If your main window has different DataContext and you can't reach this command through it you can write
<Button Command="{Binding DataContext.SaveCommand, ElementName=myControl}">Save</Button>

Add multiple buttons [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
So I want to add x buttons this value is going to be from a variable that is inputed by the user
I put like 5 tables and 5 buttons will appear.
Any help?
Sounds like you want an ItemsControl. It let's you define a template (in your case, a button) and bind to a collection of items like this:
<ItemsControl ItemsSource={Binding MyCollectionOfObjects>
<ItemsControl.ItemTemplate>
<DataTemplate>
<Button Content="{Binding MyStringProperty}"/>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>

WPF listBox collection slection changes are not working propely [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
I'm trying to load a collection to listbox as follows.(one item in listbox contains a image and a text block) IF i click each item by item in outside of the image( area 2) selection change working fine(highlight correctly); but if do the selection change by clicking each image this want work correctly.What is the reason behind this?
item by item
<DataTemplate x:Key="ObjectGalleryDataTemplate" DataType="{x:Type loc:ObjectTypes}" >
<Button Margin="3" Width="80" Height="80" Click="click_object"BorderBrush="Transparent" Tag="{Binding ObjectTypeID}">
<ItemsPanelTemplate x:Key="ObjectGalleryItemsPanelTemplate">
<UniformGrid Rows="1" HorizontalAlignment="Stretch"/>
</ItemsPanelTemplate>
<StackPanel Orientation="Horizontal">
<Grid><ListBox x:Name="ObjectTypesGallery" SelectionMode="Single" SelectionChanged="objectType_clik" BorderBrush="Transparent" SelectedIndex="0" ItemsSource="{Binding}" ItemTemplate="{DynamicResource ObjectGalleryDataTemplate}" ItemsPanel="{DynamicResource ObjectGalleryItemsPanelTemplate}">
</ListBox>
</Grid>
</StackPanel>
Since you asked:
what is the reason behind this?
The reason is that each item in a list box is automatically made selectable (so that you can choose one or more list items as part of your UI). But since you have included a button in your list item template, when you click on the button, the system is responding to the button being clicked first, in front of the list item.
You didn't specify how you want this to behave. I would guess that you should either use an <ItemsControl> if you don't want to be able to select individual items, or change your <Button> to an <Image> or something similar if you don't want to be able to click the icon in the center. Or, if you want both click events to fire (the button click, and the list item selection click), you will need to implement this manually using event handlers.

Neptune2 [just came from Mars] [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 12 years ago.
well , seriously guys i got sick of WPF errors and hard handling , look i got many buttons are dsigned to represent rooms and i want to bind into a tooltip to get occupier name and informations from database .
i cant find how to do it.
Thanks
Build a RoomViewModel class that exposes Description, IsAvailable, OtherInformation, and other properties and implements INotifyPropertyChanged. How you populate these properties is up to your application.
Build a RoomsViewModel class that exposes an ObservableCollection<RoomViewModel> named Rooms.
Create DataTemplates for the RoomViewModel and RoomsViewModel classes (see below).
Create an instance of the RoomsViewModel class and populate its Rooms collection.
Create a ContentPresenter and set its Content property to the instance of your RoomsViewModel class.
Typical data templates might look like this:
<DataTemplate x:Type="{local:RoomsViewModel}">
<ItemsControl ItemsSource="{Binding Rooms}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<WrapPanel/>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
</ItemsControl>
</DataTemplate>
<DataTemplate x:Type="{local:RoomViewModel}">
<Button
Margin="10"
IsEnabled="{Binding IsAvailable}"
ToolTip="{Binding OtherInformation}"
Content="{Binding Description}"/>
</DataTemplate>
Future enhancements:
Try using a UniformGrid instead of a WrapPanel.
Read Josh Smith's article Using RoutedCommands with a ViewModel in WPF and use the techniques described there to create a ReserveRoomCommand property on the RoomViewModel. Set the CommandBinding in the RoomViewModel data template to {Binding ReserveRoomCommand}. Note that once you do this, you'll remove the binding to IsEnabled, because the command binding will enable and disable the button automatically.
If you are going to need to reuse this UI, move the data templates and content presenter into a UserControl.

programmatically binding images to silverlight grid cell based on condition [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
how can i programmatically binding images to silverlight datagrid cell of a particular column based on the datasource values
Use an implementation of IValueConverter that I blog about here. I'll assume for the moment (your question lacks detail so I'll make some up) that you have some kind of property that exposes an enum of a finite set of states.
In your case the value converter will contain a ResourceDictionary of BitmapImage entries:-
<local:StringToObjectConverter x:Key="StatusToIcon">
<ResourceDictionary>
<BitmapImage UriSource="/Assets/State1.png" x:Key="State1" />
<BitmapImage UriSource="/Assets/State2.png" x:Key="State2" />
<BitmapImage UriSource="/Assets/UnknownState.png" x:Key="__default__" />
</ResourceDictionary>
</local:StringToObjectConverter>
In the template for your cell you would use:-
<Image Source="{Binding State, Converter={StaticResource StatusToIcon}}" />

Resources