|
Hi All,
I am using the WPF ribbon Library in my application for getting a ribbon control attached in my application.
I need the functionality where I can trap the minimize event in ribbon and do some additional stuff of code in there.
But, to my surprise I could not find any property named Minimized in ribbon .. I could found out collapsed and Expanded but they were of no use.
Can some body tell me what does IsMinimize property correspond to. As,if I know for which property the minimize functionality is attached,I can then easily solve my problem statement.
-Kushagra
I believe in Me !!!
|
|
|
|
|
Hey,
I have in my application(wpf) an Indicator for all Input Boxes, wich indicate if the box is a mandatory field or not, and changes his color if the Field is filled.
Now the product team would like to have this indicator even on radiobuttons, that means the indicator of the radiobutton should know if the others radiobuttons of the same group are filled or not to change the color to the right one.
We have a new requiredradiobutton control wich derive from the Original Control: RadioButton, and i have to programm the Indicator of the control something like that:
protected override void OnChecked(RoutedEventArgs e)
{
RadioButtonGroup myradiobuttonsgroup = this.GetRadioButtonGroup();
foreach(RadionButton rb in myradiobuttonsgroup)
{
if rb.IsChecked != true
rb.Indicator.Status = Status.NotFilled;
else
rb.Indicator.Status = Status.Filled;
}
}
Or Another way how i can handle that without puting the radiobuttons in a listbox or something.
Thanks a lot and Cheers.
Negada
modified 15-Nov-11 3:41am.
|
|
|
|
|
The way I understand it, you want the indicator in the NotFilled state if none of the radio button within the group are checked and the Filled state if at least on of the radio button (within the same group) is checked.
If this is correct, then your code is most likely wrong, this way it will set the indicator status based on the last radio button examined. Do something like
rb.Indicator.Status = myradiobuttongroup.Any(p=>p.IsChecked) ? Status.Filled : Status.NotFilled;
(not tested, may need polishing)
H.
|
|
|
|
|
Hey, thanks for replying, yes u understand it right, i know the code was just an example.. what i really need is how to get the radiogroup of my radiobutton, and if i get the radiogroup how can i get all its radiobuttons..
cheers
modified 15-Nov-11 8:10am.
|
|
|
|
|
There's no RadioButtonGroup in WPF/Silverlight AFAIK. Radio buttons are grouped by either using them in a single common parent element or using the RadioButton.GroupName property.
Mark Salsbery
|
|
|
|
|
Yes that whats i mean, how can i get all radiobuttons of a panel/window with the same groupname?
|
|
|
|
|
Can't you use databinding between the indicators and the Indicator.Status property? That would be the WPF way...
Mark Salsbery
|
|
|
|
|
Mark, i dont need for binding because i programm the logic in the control, anyway changing the indicator status isnt a problem.. what i need is how to find out all the radiobuttons if i have the groupname of one of them.
|
|
|
|
|
Iterate through the Panel.Children collection and check each elements type. If it's one of your radio buttons then check its GroupName property. VisualTreeHelper.GetChild[^] can help...
Mark Salsbery
|
|
|
|
|
Mark's method of iterating through all the children is the only public method. Lots of us use a class thats available on the internet called VisualTreeExtensions that does essentially the same thing, but wraps that code in an extension method for you. A GetVisualDecendants<RadioButton>(); call would return all the radio buttons. You could expand that to include the group name. Pretty much the same thing as what Mark suggested though.
If you are willing to use reflection, all that information has already been collected. RadioButton has a private member: private static Hashtable _groupNameToElements; thats a HashTable of ArrayLists using the group name as the key.
Some purists may frown on accessing a base class's internal data since it can easily change, but honestly, in this case, I don't see that happening. I'd just derive a class from RadioButton and implement a method that accesses _groupNameToElements so in the slight 1% chance that Microsoft ever does change that, you only need to change one place.
EDIT: See Petes post for a good point about my _groupNameToElements method .
|
|
|
|
|
Hoo boy, there's a big catch in sorting this that you need to be aware of. The Group Name is not a unique property. What do I mean by this? Well, suppose you create a usercontrol that consists of a group of radio buttons with a single group name, and then you apply that control in more than one location, then the group name would span ALL the radio buttons that contain this group name.
This is a "by-design" feature of WPF, which is intended to allow you to spread your radio buttons across multiple containers.
|
|
|
|
|
Shouldn't really be an issue since you need to iterate through the visual tree to find all the radio buttons.
|
|
|
|
|
It is if you start too high up the Visual Tree. In the example I talked about above, if you start at the root node, you will hit this problem.
|
|
|
|
|
Thank you all for The Assistance
Cheers
|
|
|
|
|
Hello,
I have a frame grabber and a DLL suplied by the FG company which alows me grab frames from the grabber.
When i write an application which directly interacts with the FG DLL every thing works fine:i initialize the FG and every captured frame the DLL trigers an event and the event handler is in my application.
What i did next is to write my own DLL which will wrap the FG DLL and will grab frames and hand it to the application.
The DLL that i wrote i used the MAF technology so my DLL is actualy an addin.
The problem is that the event handler in my addin never executed though i use the same initializations as before.
It seems that the event either never triggered or for some reason the event handler dont catch the event.
Any body have an idea for this problem?
Thanks
|
|
|
|
|
Hi,
I've stated to learn WPF and facing some binding problems when trying to bind data to data grid.
My ViewModel contains an observable collection which bounds to a data grid.
Each item in the collection contains a user name and other additional info.
One of the requirements is to display each item in the data grid,
while each user will have its own color(which is part of the additional info).
For some reason I can't find a way to bind the row background color.
My XAML looks like this:
<DataGrid AutoGenerateColumns="False" ItemsSource="{Binding PostsCollection}">
<DataGrid.Columns>
<DataGridTextColumn Header="UserName" Binding="{Binding UserName}"/>
<DataGridTextCOlumn Header="Status" Binding="{Binding Status}"/>
</DataGrid.Columns>
</DataGrid>
Can anyone help me with this issue?
Thanks,
Best regards,
Eli
|
|
|
|
|
Use the Background and AlternatingRowBackground properties.
|
|
|
|
|
Hi
Background and AlternativeRowBackground isn't good enough.
As I mentioned before , the color of each row shall be retreived from the model(stored in the database).
Also,there can be more than 2 users,and each user have it's own color.
Tanks for your help,
Eli
|
|
|
|
|
You will need to create a RowStyle for your DataGrid and bind the Background property to the ColourProperty on your class. Something like this:-
<DataGrid ItemsSource="{Binding Path=PostCollection}" AutoGenerateColumns="False">
<DataGrid.RowStyle>
<Style TargetType="DataGridRow">
<Setter Property="Background" Value="{Binding Path=RowColour}"/>
</Style>
</DataGrid.RowStyle>
<DataGrid.Columns>
<DataGridTextColumn Header="UserName" Binding="{Binding UserName}"/>
<DataGridTextColumn Header="Status" Binding="{Binding Status}"/>
</DataGrid.Columns>
</DataGrid>
This obviously assumes the colour property of your user class is called RowColour and that it returns a Brush type. If not you will need to provide a converter if your property returns a Color or string type.
Hope this helps
When I was a coder, we worked on algorithms. Today, we memorize APIs for countless libraries — those libraries have the algorithms - Eric Allman
|
|
|
|
|
It sure did...
Wow...I guess WPF is much more difficult than i thought.
Thanks a lot..
Best regards,
Eli
|
|
|
|
|
Glad to help
eli15021979 wrote: Wow...I guess WPF is much more difficult than i thought.
Once you get the hang of it, it becomes second nature, then you will be amazed at what you can accomplish with it.
Good luck.
When I was a coder, we worked on algorithms. Today, we memorize APIs for countless libraries — those libraries have the algorithms - Eric Allman
|
|
|
|
|
I have been searching on the internet for a sample to show me how to show the sql server reporting services (SSRS) reports from a silverlight page i.e. (.xaml)
I have seen where an .aspx file should be used but there is no example on how to use the .aspx page inside or from the .xaml page.
Can you please let me know or point me to a simple site where I can see how to show my SSRS reports from my silverlight application?
Thanks
|
|
|
|
|
|
Thank you for the link which I had seen before.
What I would liek to find out is that in this link which you sent, where do I add the /RpDemoWebForm.aspx webform?
Is it added to the host which has a default.aspx or o the silverlight project?
Thanks
|
|
|
|
|
I have added mine in a folder in the web project (where the default.aspx lives. In that folder I have all the bits required to get the data and the .rdlc files with the viewer aspx
Never underestimate the power of human stupidity
RAH
|
|
|
|