Telerik Forums
UI for WPF Forum
3 answers
329 views
Hello,
i have a controltemplate for GridViewCell and I'm having some problems with its binding.
First of all when i used: (the column is binded to Price)
Text="{Binding Path=Content.Field.Value}" 
The value disapears from the cell when the row is selected.

Then i tried:
Text="{Binding Path=DataContext.Price, Mode=TwoWay, Converter = {StaticResource CentPriceConverter}, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type telerik:GridViewRow}}}" 
but this way the value in the source object  is not updated. the setter is called with the old value

can you tell what I'm doing wrong?

my controlTemplate looks like this:
                <ControlTemplate x:Key="PriceExpandedCell" TargetType="telerik:GridViewCell">  
                    <Border Name="Part_Border"   
                            CornerRadius="0"   
                            Loaded="Part_Border_Loaded" 
                            Height="Auto" 
                            BorderBrush="{StaticResource SolidBorderBrush}" 
                            VerticalAlignment="Stretch">  
                        <StackPanel Name="Part_StackPanel"   
                                    ScrollViewer.VerticalScrollBarVisibility="Hidden" 
                                    Orientation="Vertical" 
                                    Background="{Binding Path=Background, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type telerik:GridViewRow}}}">  
                            <TextBox Name="Part_Text"    
                                     Width="Auto"   
                                     BorderThickness="0" 
                                     Background="Transparent" 
                                     Margin="2,2,2,2"   
                                     TextChanged="Part_Text_TextChanged" 
                                     Foreground="{Binding Path=Foreground, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type telerik:GridViewRow}}}" 
                                     Text="{Binding Path=DataContext.Price, Mode=TwoWayConverter = {StaticResource CentPriceConverter},   
                                RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type telerik:GridViewRow}}}"/> 
                            <Button Content="Discount" Margin="15,3,3,3"   
                                    Name="btnDiscount" 
                                    Click="btnDiscount_Click" 
                                    HorizontalAlignment="Left" 
                                    Style="{StaticResource CompactButton}"/>  
                        </StackPanel> 
                    </Border> 
                    <ControlTemplate.Triggers> 
                        <DataTrigger Binding="{Binding Path=IsSelected, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type telerik:GridViewRow}}}" Value="True">  
                            <Setter TargetName="Part_StackPanel" Property="Background" Value="{StaticResource HighlightGradientBrush}"/>  
                        </DataTrigger> 
                        <Trigger Property="IsInEditMode" Value="True">  
                            <Setter TargetName="Part_Border" Property="BorderThickness" Value="3"/>  
                            <Setter TargetName="Part_StackPanel" Property="Background" Value="{StaticResource LightBlueBrush}"/>  
                        </Trigger> 
 
                    </ControlTemplate.Triggers> 
                </ControlTemplate> 
 

Thanks!

Dimitrina
Telerik team
 answered on 16 Dec 2014
1 answer
171 views
Hello,

Could you please point me to a working code of WPF (that uses a ribbon view similar  to Microsoft word) and using PRISM (and unity or MEF). Thanks.

-Jayanth 
Pavel R. Pavlov
Telerik team
 answered on 16 Dec 2014
8 answers
366 views
Hello!
How to bind the radribbon tab to a command?
like ... <RadRibbonTab Command="{Binding MyCommand}"...>

Thanks.
Ram
Top achievements
Rank 1
 answered on 15 Dec 2014
2 answers
87 views
Is there a property that I can reliably use to determine if the CloudUpload is currently working on 1 or more uploads? I suppose I could subscribe to one of the events and set a custom property if not.
Kiril Vandov
Telerik team
 answered on 15 Dec 2014
1 answer
111 views
Hello, I'm setting up a windows explorer tree view and when it displays, I get a header node then C: then Folder then File.    How can I suppress the Header and drive letter so the first node starts with a sub-folder?  I can't find an event to filter as it's creating the node structure.

attached in yellow are the two nodes I would like to remove on initialization of the control.

thanks.
Martin Ivanov
Telerik team
 answered on 15 Dec 2014
1 answer
106 views
Hi
I'm trying to using RadBook control to display a PDF file and also a custom control named DrawingCanvas to draw some shapes over the PDF file loaded.
I've done this successfully thanks to the vast amount of samples available.
Here is how I do:

I load the file as follows:
private void LoadFile(String filePath)
{
    documentStream = new FileStream(filePath, FileMode.Open);
    var doc = new PdfFormatProvider(documentStream, FormatProviderSettings.ReadOnDemand).Import();
    book.ItemsSource = doc.Pages;
}

And here is the DataTemplate which I use:
<DataTemplate x:Key="PageTemplate">
            <Viewbox>
                     <Grid>
                    <ui:FixedDocumentSinglePagePresenter Page="{Binding}" Width="500" Height="500"/>
                    <hosts:DrawingCanvas Width="500" Height="500" Margin="15" Background="#00000000" />
                </Grid>
            </Viewbox>
        </DataTemplate>
And everything works great.
My problem is that, when the page is changed (on PageChanged event), I want to access the DrawingCanvas!
I tries the 2 approaches mentioned in this post How to access controls in RadBook DataTemplete?, but it doesn't help me.
When using the loaded event, I have 2 problems:
  1. When paging back, the events (sometimes) does not raise!
  2. It seems the RadBook caches the pages, so while RightPageIndex is 0, I get events of canvases in page 1 and 2.

And when trying to use the RadBook.ItemContainerGenerator the problem is that myBook.ItemContainerGenerator.ContainerFromIndex(leftPageInd) returns null,
and I also tried to use the book.Items property, but my Items type are RadFixedPage (because I've set ItemsSource of book to PdfFormatProvider's Pages property) and I don't know how can I use it to get my DrawingCanvas.

Regards, Vahid 

Martin Ivanov
Telerik team
 answered on 15 Dec 2014
2 answers
945 views
I am attempting to set a style for the RadWatermarkTextbox as follows;

<Style TargetType="telerik:RadWatermarkTextBox" x:Key="RadWatermark">
    <Style.Triggers>
        <DataTrigger Binding="{Binding Path=IsActive}" Value="False">
            <Setter Property="TextBlock.Foreground" Value="Red"/>
            <Setter Property="TextBlock.Background" Value="LightYellow" />
        </DataTrigger>
    </Style.Triggers>
</Style>

The foreground colour changers to red but the background appears grey.  I haver tried various opacity settings and also;

<Style TargetType="telerik:RadWatermarkTextBox" x:Key="RadWatermark">
    <Style.Triggers>
        <DataTrigger Binding="{Binding Path=IsActive}" Value="False">
            <Setter Property="TextBlock.Foreground" Value="Red"/>
            <Setter Property="TextBlock.Background" Value="LightYellow" />
            <Setter Property="Background" Value="LightYellow" />
        </DataTrigger>
    </Style.Triggers>
</Style>

but the best I seem to get is a dirty-yellow background.

How do I override the default "battleship grey"?
Raymond
Top achievements
Rank 1
 answered on 15 Dec 2014
2 answers
131 views
We have a grid with its ItemsSource bound to a QCV (and an EF query as source). There has to be a sorted column so that Paging works properly. However, I can also completely remove a sort which means paging is no longer working. How can I prevent the user from "un-sorting" a column? What I would like to have is instead of a threestate sorting (asc, desc, unsorted) only a twostate sorting (asc, desc). Any idea?

Regards
Neils
Heiko
Top achievements
Rank 1
Iron
Veteran
 answered on 14 Dec 2014
4 answers
173 views
Hi,

In a separate thread (so I can't access RadRichTextBox object) I manipulate a RadDocument.
Now, I want to copy the TableCell "source" into the TableCell "destination"

For the style and options I use:
destination.CopyPropertiesFrom(source);

For the content I use:
foreach (Block b in source.Blocks)
destination.Blocks.Add((Block)b.CreateDeepCopy());

All work good but, then CreateDeepCopy method generates a document that is not possible to export as pdf.
Workarounds?

Thank,
marc.
Tanya
Telerik team
 answered on 13 Dec 2014
7 answers
138 views
Hello,

Could you please specify how can a button placed in the CellTemplate tag of a GridViewDataColumn (1) map the row in which the button is placed at click?
In my implementation, I need to embed buttons in each row of a specific column in order to remove those rows. The button is bound to a command which removes the CurrentItem from the ListCollectionView bound to the GridView (2).
However, clicking the embedded button doesn't mark its row as the selected one and the command removes the row which is marked as Selected in the GridView (by clicking on one of the columns which don't embed the mentioned button).
In conclusion, the button is supposed to mark its row as selected when clikcked, in order for the bound Command to remove the desired row, without having to click on the row (thus selecting it) and then click on the button.




Boris
Telerik team
 answered on 12 Dec 2014
Narrow your results
Selected tags
Tags
+? more
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?