Checkbox tick direction [duplicate] - wpf

This question already has answers here:
Checkbox with RightToLeft flow direction in Windows 8.1
(2 answers)
Closed 2 years ago.
I have a checkbox as per the photo below. I'm curious why my 'checked' symbol look so weird and laterally inverted. I intentionally to use FlowDirection ="RightToLeft" is to ensure my text is at left side of the checkbox.
Below are my XMAL:
<CheckBox Grid.Column="1" Grid.Row="9" Content="Stop Immediately"
IsChecked="{Binding StopImmediately}" FlowDirection="RightToLeft"
Margin="-30,15,5,0" />

Liew,
I can see that you want the Text to be on the left side of the checkbox, but you want the tick direction to function normally. Here is a solution to your problem:
<CheckBox FlowDirection="RightToLeft" Grid.Row="9"
IsChecked="{Binding StopImmediately}"
Margin="-30,15,5,0">
<TextBlock FlowDirection="LeftToRight" Text="Stop Immediately" />
</CheckBox>
Does this solve your problem?
Thanks,

Related

DevExpress PageSetupCommand - button greyed out. (What is its CanExecute() method doing?)

I have a WPF control with a button, whose command is bound to a DevExpress DocumentPreviewControl PageSetupCommand. However, this button always appears to be automatically greyed out.
<Button Content="Page Setup"
Command="{Binding PageSetupCommand, ElementName=binReportPrintSettings}"
MinWidth="90" MaxHeight="36" HorizontalAlignment="Left" Margin="8,0"
Visibility="{Binding Model.IsBinaryReportAvailable, Converter={StaticResource BoolToVisibilityConverter}}"
IsEnabled="True"/>
.
.
.
<dxp:DocumentPreviewControl Grid.Column="2" CommandBarStyle="None"
x:Name="binReportPrintSettings" FocusVisualStyle="{x:Null}" ZoomMode="FitToWidth"
DocumentSource="{Binding Model.Report}"
Visibility="{Binding Model.IsBinaryReportAvailable, Converter={StaticResource BoolToVisibilityConverter}}" />
After a bit of debugging, I've found that the binReportPrintSettings.PageSetupCommand.CanExecute() returns false which I'm thinking is the reason for this.
So for full disclosure - The Model.Report which the DocumentPreviewControl is bound to is null
(though I've also tried with a new XtraReport()). The reason for this is that what I actually plan to print is a PDF report which was supplied as binary data. The preview is actually displayed by a separate PdfViewerControl.
<dxpdf:PdfViewerControl Name="pdfReportViewer" DetachStreamOnLoadComplete="True"
DocumentSource="{Binding Model.BinaryReport.Data}"
CommandBarStyle="None" NumberOfRecentFiles="0" IsReadOnly="True"
ZoomMode="FitToVisible" ShowOpenFileOnStartScreen="False"
Visibility="{Binding Model.IsBinaryReportAvailable, Converter={StaticResource BoolToVisibilityConverter}}">
</dxpdf:PdfViewerControl>
But the PdfViewerControl doesn't have a PageSetupCommand, and the DocumentPreviewControl can't accept an array of bytes / Memory stream as a DocumentSource (at least not for a PDF).
So my question is, is there a way I can display the PageSetupCommand (or the same Dialog box in some way) in this situation?

How to even out a few text-boxes in stack-panel in XAML? [duplicate]

This question already has an answer here:
Fill all available space in ItemsComtrol with same width size of elements
(1 answer)
Closed 3 years ago.
I have 7 text-boxes containing weekday's names from Monday to Sunday. My problem is that I want to put each of those in a textbox inside the stack panel and get them to fill the entire stack panel horizontally so that each textbox has the same width.
How can that be achieved instead of the picture below of my attempt?
Use a WrapPanel instead and specify a minimum ItemWidth
<WrapPanel ItemWidth="140">
<TextBlock Text="Monday"/>
<TextBlock Text="Tuesday"/>
<TextBlock Text="Wednesday"/>
<TextBlock Text="Thursday"/>
<TextBlock Text="Friday"/>
<TextBlock Text="Saturday"/>
<TextBlock Text="Sunday"/>
</WrapPanel>

How to prevent the dragablz tabs of being reordered by the user?

I want to disable the option of reordering tabs using the dragablz tabs.
How can I do it?
As you can see in the attached code, I have removed the TabablzControl.InterTabController, and it helped me with the problem of dragging tabs out of a window into a new one. But I also need to prevent changing their order, and I have no clue how to do that.
<Grid Margin="0,0,2,0">
<dragablz:TabablzControl Margin="8" TabStripPlacement="Left" AllowDrop="False" >
<!--if you want to allow dragging tabs out of the window into a new window (loke googke Chrome) then uncomment next lines.-->
<!--<dragablz:TabablzControl.InterTabController>
<dragablz:InterTabController/>
</dragablz:TabablzControl.InterTabController>-->
<TabItem Header="Tab No. 1" IsSelected="True">
<TextBlock>Hello World</TextBlock>
</TabItem>
<TabItem Header="Tab No. 2">
<TextBlock>We Have Tearable Tabs!</TextBlock>
</TabItem>
</dragablz:TabablzControl>
</Grid>
Ok, I have figured it out. In the second line add an attribute FixedHeaderCount.
This attribute gets as value the number of tabs that you want to be fixed.
So If you have 3 tabs, and you want them all to be fixed the second line should look like that:
<dragablz:TabablzControl Margin="8" TabStripPlacement="Left" AllowDrop="False" FixedHeaderCount="3">

What is the meaning of {Binding Path = .} [duplicate]

This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
Special symbols in WPF binding - what does “{Binding Path=.}” mean?
I am not getting the meaning of following code -
<DataTemplate>
<Label>
<Hyperlink Command="{Binding Path=.}">
<TextBlock Text="{Binding Path=Header}"/>
</Hyperlink>
</Label>
</DataTemplate>
Can anyone explain it.
It is used to bind to the current source .
For more info take a look here Binding Path
hope this helps
Binding basically you are going to binding to ViewModel class. For e.g. you have an class called person and it has property called "Name". What you need to do here is, So it will bind to your Class called Person and it's property called "Name".
<TextBlock Text="{Binding Path=Name}"/>

Making an image control invert its colors depending on theme

I'm trying to work out how to have an Image control in my Windows Phone application invert its colors based on the global background setting (either "Dark" or "Light") chosen by the user in Settings->Themes->Background.
There is no built-in way to invert image colors within the framework.
Instead, because of the overhead of doing this on the phone, you should create both versions of the image at design/build time and then choose which version to display from your code by detecting Theme Visibility and Opacity.
I must add that what i did in the end was a continuation of what Matt wrote.
create two different images that have different versions of the image (dark and light) and place them in the exact same position
set their visibility based on the theme resource
the code looks like this:
<Image Height="30" HorizontalAlignment="Center" Margin="0,0,0,220" Name="imgDark" Stretch="Fill" Visibility="{StaticResource PhoneLightThemeVisibility}" VerticalAlignment="Center" Width="30" Source="/MyApplication;component/imageDarkTheme.png" />
<Image Height="30" HorizontalAlignment="Center" Margin="0,0,0,220" Name="imgLoading" Stretch="Fill" Visibility="{StaticResource PhoneDarkThemeVisibility}" VerticalAlignment="Center" Width="30" Source="/MyApplication;component/imageLightTheme.png" />
This Question is 1.5 years old now. But here is the easiest way to do what you want. The example given there is very simple like
<Button>
<Image Stretch="None" Source="{Binding Converter={StaticResource ThemedImageConverter}, ConverterParameter={StaticResource PhoneBackgroundColor} }"
DataContext="/WP7SampleProject4;component/Images/{0}/appbar.feature.camera.rest.png" />
</Button>

Resources